Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<NoWarn>701;1702;CA1845</NoWarn>
<NoWarn>701;1702;CA1845;MA0004</NoWarn>
<OutputPath>..\..\Build\Tests\$(MSBuildProjectName)</OutputPath>
</PropertyGroup>

Expand Down
14 changes: 7 additions & 7 deletions Tests/Testably.Abstractions.Testing.Tests/NotificationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public void AwaitableCallback_Amount_ShouldOnlyReturnAfterNumberOfCallbacks()

_ = Task.Run(async () =>
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1);
}
});

Expand Down Expand Up @@ -84,11 +84,11 @@ public void AwaitableCallback_Filter_ShouldOnlyUpdateAfterFilteredValue()

_ = Task.Run(async () =>
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1);
}
});

Expand All @@ -109,11 +109,11 @@ public void AwaitableCallback_Predicate_ShouldOnlyUpdateAfterFilteredValue()

_ = Task.Run(async () =>
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
for (int i = 1; i <= 10; i++)
{
timeSystem.Thread.Sleep(i);
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1);
}

ms.Set();
Expand Down Expand Up @@ -142,7 +142,7 @@ public void AwaitableCallback_ShouldWaitForCallbackExecution()
while (!ms.IsSet)
{
timeSystem.Thread.Sleep(1);
await Task.Delay(1).ConfigureAwait(false);
await Task.Delay(1);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Method_WaitForChanged_WatcherChangeTypes_Int_ShouldRegisterCall()
{
while (!token.IsCancellationRequested)
{
await Task.Delay(10, token).ConfigureAwait(false);
await Task.Delay(10, token);
sut.Directory.CreateDirectory(sut.Path.Combine("foo", "some-directory"));
sut.Directory.Delete(sut.Path.Combine("foo", "some-directory"));
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public void Method_WaitForChanged_WatcherChangeTypes_ShouldRegisterCall()
{
while (!token.IsCancellationRequested)
{
await Task.Delay(10, token).ConfigureAwait(false);
await Task.Delay(10, token);
sut.Directory.CreateDirectory(sut.Path.Combine("foo", "some-directory"));
sut.Directory.Delete(sut.Path.Combine("foo", "some-directory"));
}
Expand Down Expand Up @@ -107,7 +107,7 @@ public void Method_WaitForChanged_WatcherChangeTypes_TimeSpan_ShouldRegisterCall
{
while (!token.IsCancellationRequested)
{
await Task.Delay(10, token).ConfigureAwait(false);
await Task.Delay(10, token);
sut.Directory.CreateDirectory(sut.Path.Combine("foo", "some-directory"));
sut.Directory.Delete(sut.Path.Combine("foo", "some-directory"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public async Task AppendAllLinesAsync_MissingDirectory_ShouldThrowDirectoryNotFo
string filePath = FileSystem.Path.Combine(missingPath, fileName);
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllLinesAsync(filePath, contents).ConfigureAwait(false);
await FileSystem.File.AppendAllLinesAsync(filePath, contents);
});

exception.Should().BeException<DirectoryNotFoundException>(hResult: -2147024893);
Expand All @@ -95,7 +95,7 @@ public async Task AppendAllLinesAsync_NullContent_ShouldThrowArgumentNullExcepti
{
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllLinesAsync(path, null!).ConfigureAwait(false);
await FileSystem.File.AppendAllLinesAsync(path, null!);
});

exception.Should().BeException<ArgumentNullException>(
Expand All @@ -110,7 +110,7 @@ public async Task AppendAllLinesAsync_NullEncoding_ShouldThrowArgumentNullExcept
{
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllLinesAsync(path, new List<string>(), null!).ConfigureAwait(false);
await FileSystem.File.AppendAllLinesAsync(path, new List<string>(), null!);
});

exception.Should().BeException<ArgumentNullException>(
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllLinesAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.AppendAllLinesAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task AppendAllTextAsync_MissingDirectory_ShouldThrowDirectoryNotFou
string filePath = FileSystem.Path.Combine(missingPath, fileName);
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllTextAsync(filePath, contents).ConfigureAwait(false);
await FileSystem.File.AppendAllTextAsync(filePath, contents);
});

exception.Should().BeException<DirectoryNotFoundException>(hResult: -2147024893);
Expand Down Expand Up @@ -102,7 +102,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.AppendAllTextAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.AppendAllTextAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public async Task OpenRead_WriteAsync_ShouldThrowNotSupportedException(
// ReSharper disable once UseAwaitUsing
using FileSystemStream stream = FileSystem.File.OpenRead(path);
#pragma warning disable CA1835
await stream.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
await stream.WriteAsync(bytes, 0, bytes.Length);
#pragma warning restore CA1835
});

Expand All @@ -100,7 +100,7 @@ public async Task OpenRead_WriteAsyncWithMemory_ShouldThrowNotSupportedException
Exception? exception = await Record.ExceptionAsync(async () =>
{
using FileSystemStream stream = FileSystem.File.OpenRead(path);
await stream.WriteAsync(bytes.AsMemory()).ConfigureAwait(false);
await stream.WriteAsync(bytes.AsMemory());
});

exception.Should().BeException<NotSupportedException>(hResult: -2146233067);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task ReadLinesAsync_Cancelled_ShouldThrowTaskCanceledException(

Exception? exception = await Record.ExceptionAsync(async () =>
{
await foreach (string _ in FileSystem.File.ReadLinesAsync(path, cts.Token).ConfigureAwait(false))
await foreach (string _ in FileSystem.File.ReadLinesAsync(path, cts.Token))
{
// do nothing
}
Expand All @@ -46,7 +46,7 @@ public async Task
Exception? exception = await Record.ExceptionAsync(async () =>
{
await foreach (string _ in FileSystem.File.ReadLinesAsync(path, Encoding.UTF8,
cts.Token).ConfigureAwait(false))
cts.Token))
{
// do nothing
}
Expand All @@ -62,7 +62,7 @@ public async Task ReadLinesAsync_MissingFile_ShouldThrowFileNotFoundException(
{
Exception? exception = await Record.ExceptionAsync(async () =>
{
await foreach (string _ in FileSystem.File.ReadLinesAsync(path).ConfigureAwait(false))
await foreach (string _ in FileSystem.File.ReadLinesAsync(path))
{
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task WriteAllBytesAsync_WhenBytesAreNull_ShouldThrowArgumentNullExc
{
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllBytesAsync(path, null!).ConfigureAwait(false);
await FileSystem.File.WriteAllBytesAsync(path, null!);
});

exception.Should().BeException<ArgumentNullException>(paramName: "bytes");
Expand All @@ -73,7 +73,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllBytesAsync(path, bytes).ConfigureAwait(false);
await FileSystem.File.WriteAllBytesAsync(path, bytes);
});

exception.Should().BeException<UnauthorizedAccessException>(
Expand All @@ -95,7 +95,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllBytesAsync(path, bytes).ConfigureAwait(false);
await FileSystem.File.WriteAllBytesAsync(path, bytes);
});

exception.Should().BeException<UnauthorizedAccessException>(hResult: -2147024891);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllLinesAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.WriteAllLinesAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(
Expand All @@ -153,7 +153,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllLinesAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.WriteAllLinesAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(hResult: -2147024891);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public async Task WriteAllTextAsync_WhenContentIsNull_ShouldNotThrowException(st
{
Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllTextAsync(path, null).ConfigureAwait(false);
await FileSystem.File.WriteAllTextAsync(path, null);
});

exception.Should().BeNull();
Expand All @@ -114,7 +114,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllTextAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.WriteAllTextAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(
Expand All @@ -136,7 +136,7 @@ public async Task

Exception? exception = await Record.ExceptionAsync(async () =>
{
await FileSystem.File.WriteAllTextAsync(path, contents).ConfigureAwait(false);
await FileSystem.File.WriteAllTextAsync(path, contents);
});

exception.Should().BeException<UnauthorizedAccessException>(hResult: -2147024891);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public async Task ReadAsync_CanReadFalse_ShouldThrowNotSupportedException(
{
// ReSharper disable once AccessToDisposedClosure
#pragma warning disable CA1835
_ = await stream.ReadAsync(buffer, 0, bytes.Length, cts.Token).ConfigureAwait(false);
_ = await stream.ReadAsync(buffer, 0, bytes.Length, cts.Token);
#pragma warning restore CA1835
});

Expand All @@ -220,7 +220,7 @@ public async Task ReadAsync_Memory_CanReadFalse_ShouldThrowNotSupportedException
{
// ReSharper disable once AccessToDisposedClosure
#pragma warning disable CA1835
_ = await stream.ReadAsync(buffer.AsMemory(), cts.Token).ConfigureAwait(false);
_ = await stream.ReadAsync(buffer.AsMemory(), cts.Token);
#pragma warning restore CA1835
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task CopyToAsync_BufferSizeZero_ShouldThrowArgumentOutOfRangeExcept
{
using FileSystemStream stream = FileSystem.File.OpenRead(path);
using MemoryStream destination = new(buffer);
await stream.CopyToAsync(destination, 0).ConfigureAwait(false);
await stream.CopyToAsync(destination, 0);
});

exception.Should().BeException<ArgumentOutOfRangeException>(
Expand Down Expand Up @@ -222,7 +222,7 @@ public async Task FlushAsync_Cancelled_ShouldThrowTaskCanceledException(
{
// ReSharper disable once UseAwaitUsing
using FileSystemStream stream = FileSystem.File.Create(path);
await stream.FlushAsync(cts.Token).ConfigureAwait(false);
await stream.FlushAsync(cts.Token);
});

exception.Should().BeException<TaskCanceledException>(hResult: -2146233029);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public async Task WriteAsync_CanWriteFalse_ShouldThrowNotSupportedException(
{
// ReSharper disable once AccessToDisposedClosure
#pragma warning disable CA1835
await stream.WriteAsync(buffer, 0, bytes.Length, cts.Token).ConfigureAwait(false);
await stream.WriteAsync(buffer, 0, bytes.Length, cts.Token);
#pragma warning restore CA1835
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void FileSystemWatcherOnChanged(object sender, FileSystemEventArgs e)
int i = 0;
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.File.WriteAllText(path, i++.ToString(CultureInfo.InvariantCulture));
}
});
Expand Down Expand Up @@ -78,7 +78,7 @@ void FileSystemWatcherOnCreated(object sender, FileSystemEventArgs e)
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down Expand Up @@ -124,7 +124,7 @@ void FileSystemWatcherOnDeleted(object sender, FileSystemEventArgs e)
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down Expand Up @@ -173,7 +173,7 @@ void FileSystemWatcherOnRenamed(object sender, FileSystemEventArgs e)
FileSystem.File.WriteAllText($"path-{i}", "");
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.File.Move($"path-{i}", $"path-{++i}");
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void BeginInit_ShouldStopListening(string path)
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down Expand Up @@ -85,7 +85,7 @@ public void EndInit_ShouldRestartListening(string path)
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void WaitForChanged_ShouldBlockUntilEventHappens(string path)
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down Expand Up @@ -67,7 +67,7 @@ public void WaitForChanged_Timeout_ShouldReturnTimedOut(string path,
{
while (!ms.IsSet)
{
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
FileSystem.Directory.CreateDirectory(path);
FileSystem.Directory.Delete(path);
}
Expand Down
Loading