Skip to content

Commit 7889ad7

Browse files
committed
Update FileSystemCacheTests.cs
1 parent 14e9ac0 commit 7889ad7

1 file changed

Lines changed: 3 additions & 17 deletions

File tree

tests/SecureFolderFS.Tests/FileSystemTests/FileSystemCacheTests.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
21
using System.Text;
3-
using System.Threading;
42
using FluentAssertions;
53
using NUnit.Framework;
64
using OwlCore.Storage;
@@ -40,7 +38,7 @@ public async Task Write_SmallStreamedFile_Then_WriteAgain_Ensure_CacheHit_NoThro
4038

4139
var cacheHits = 0;
4240
var cacheMisses = 0;
43-
_storageRoot.Options.FileSystemStatistics.ChunkCache = new InlineProgress<CacheAccessType>(x =>
41+
_storageRoot.Options.FileSystemStatistics.ChunkCache = new Progress<CacheAccessType>(x =>
4442
{
4543
if (x == CacheAccessType.CacheHit)
4644
Interlocked.Increment(ref cacheHits);
@@ -61,24 +59,12 @@ public async Task Write_SmallStreamedFile_Then_WriteAgain_Ensure_CacheHit_NoThro
6159
var buffer = new byte[stream.Length];
6260
var read = await stream.ReadAsync(buffer);
6361

64-
Console.WriteLine($"Cache Hits: {cacheHits}");
65-
Console.WriteLine($"Cache Misses: {cacheMisses}");
62+
Console.WriteLine($@"Cache Hits: {cacheHits}");
63+
Console.WriteLine($@"Cache Misses: {cacheMisses}");
6664

6765
read.Should().Be((int)stream.Length);
6866
Encoding.UTF8.GetString(buffer).Should().BeEquivalentTo(dataString + dataString);
6967
cacheMisses.Should().Be(1);
7068
}
71-
72-
private sealed class InlineProgress<T> : IProgress<T>
73-
{
74-
private readonly Action<T> _handler;
75-
76-
public InlineProgress(Action<T> handler)
77-
{
78-
_handler = handler ?? throw new ArgumentNullException(nameof(handler));
79-
}
80-
81-
public void Report(T value) => _handler(value);
82-
}
8369
}
8470
}

0 commit comments

Comments
 (0)