Skip to content

Commit

Permalink
dotnet 8 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbilas committed Nov 22, 2023
1 parent ddb8d87 commit 97f599b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Core/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ public static IEnumerable<object> Flatten(this IEnumerable @this) =>

// copy to collection

# if !NET8_0_OR_GREATER
public static Dictionary<TKey, TValue> ToDictionary<TKey, TValue>(this IEnumerable<(TKey key, TValue value)> @this) where TKey: notnull =>
@this.ToDictionary(item => item.key, item => item.value);
# endif

public static Queue<T> ToQueue<T>(this IEnumerable<T> @this) =>
new(@this);
Expand Down
9 changes: 9 additions & 0 deletions src/Core/FileStreamNativeExtensions.t.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.ComponentModel;

#pragma warning disable CA1001
class FileStreamNativeExtensionsTests : TestFileSystemFixture
#pragma warning restore CA1001
Expand Down Expand Up @@ -58,6 +60,13 @@ public void WasFileDeleted_WithDeletedAndRecreatedFile_ReturnsTrue()
public void WasFileDeleted_WithClosedFile_Throws()
{
_stream.Close();

#if NET8_0_OR_GREATER
Should
.Throw<Win32Exception>(() => _stream.WasFileDeleted())
.Message.ShouldContain("GetFileInformationByHandleEx() failed");
#else
Should.Throw<ObjectDisposedException>(() => _stream.WasFileDeleted());
#endif
}
}

0 comments on commit 97f599b

Please sign in to comment.