From 58eb5fbe8acadd08159d7b41c2789217fb7eb4d7 Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Thu, 16 Jan 2025 16:40:45 +0100 Subject: [PATCH 1/5] remove fluent assertions, update dependencies --- Directory.Packages.props | 94 +++++++++---------- global.json | 2 +- src/QuickIO/QuickIODirectory_Attributes.cs | 1 - .../QuickIODirectory_Attributes_Async.cs | 1 - src/QuickIO/QuickIODirectory_FileTime.cs | 1 - .../QuickIODirectory_FileTime_Async.cs | 1 - src/QuickIO/QuickIODirectory_Root.cs | 1 - src/QuickIO/QuickIODirectory_Root_Async.cs | 1 - src/QuickIO/QuickIOFile_Attributes.cs | 1 - src/QuickIO/QuickIOFile_Attributes_Async.cs | 1 - src/QuickIO/QuickIOFile_FileTime.cs | 1 - src/QuickIO/QuickIOFile_FileTime_Async.cs | 1 - src/QuickIO/QuickIOFile_Root.cs | 1 - src/QuickIO/QuickIOFile_Root_Async.cs | 1 - .../QuickIO.IntegrationTests.csproj | 2 - .../QuickIO.UnitTests.csproj | 42 ++++----- .../QuickIO_Directory_Enumeration_Tests.cs | 5 +- .../QuickIO_Directory_Tests.cs | 15 ++- tests/QuickIO.UnitTests/QuickIO_File_Tests.cs | 2 +- .../QuickIO_PathInfo_Tests.cs | 27 +++--- .../QuickIO_Transfer_CopyJob.cs | 30 +++--- .../RandomTestFileProvider.cs | 2 +- 22 files changed, 105 insertions(+), 128 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index e689e89..1740cb7 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,52 +1,46 @@ - - true - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers - - + + true + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers + + \ No newline at end of file diff --git a/global.json b/global.json index 6b9d217..ee2876e 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "9.0.100-preview.7.24407.12" + "version": "9.0.102" } } diff --git a/src/QuickIO/QuickIODirectory_Attributes.cs b/src/QuickIO/QuickIODirectory_Attributes.cs index 9bef7fe..0d2bf0f 100644 --- a/src/QuickIO/QuickIODirectory_Attributes.cs +++ b/src/QuickIO/QuickIODirectory_Attributes.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIODirectory_Attributes_Async.cs b/src/QuickIO/QuickIODirectory_Attributes_Async.cs index 7f9edcc..7900d07 100644 --- a/src/QuickIO/QuickIODirectory_Attributes_Async.cs +++ b/src/QuickIO/QuickIODirectory_Attributes_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIODirectory_FileTime.cs b/src/QuickIO/QuickIODirectory_FileTime.cs index 3b26c83..af78ceb 100644 --- a/src/QuickIO/QuickIODirectory_FileTime.cs +++ b/src/QuickIO/QuickIODirectory_FileTime.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIODirectory_FileTime_Async.cs b/src/QuickIO/QuickIODirectory_FileTime_Async.cs index 09b7bf9..a0abd80 100644 --- a/src/QuickIO/QuickIODirectory_FileTime_Async.cs +++ b/src/QuickIO/QuickIODirectory_FileTime_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIODirectory_Root.cs b/src/QuickIO/QuickIODirectory_Root.cs index 2939e7e..8996def 100644 --- a/src/QuickIO/QuickIODirectory_Root.cs +++ b/src/QuickIO/QuickIODirectory_Root.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIODirectory_Root_Async.cs b/src/QuickIO/QuickIODirectory_Root_Async.cs index a66ea83..931f4fa 100644 --- a/src/QuickIO/QuickIODirectory_Root_Async.cs +++ b/src/QuickIO/QuickIODirectory_Root_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_Attributes.cs b/src/QuickIO/QuickIOFile_Attributes.cs index aaf62bd..7610451 100644 --- a/src/QuickIO/QuickIOFile_Attributes.cs +++ b/src/QuickIO/QuickIOFile_Attributes.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_Attributes_Async.cs b/src/QuickIO/QuickIOFile_Attributes_Async.cs index 47458d7..645d94b 100644 --- a/src/QuickIO/QuickIOFile_Attributes_Async.cs +++ b/src/QuickIO/QuickIOFile_Attributes_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_FileTime.cs b/src/QuickIO/QuickIOFile_FileTime.cs index 2e65a69..b2d5739 100644 --- a/src/QuickIO/QuickIOFile_FileTime.cs +++ b/src/QuickIO/QuickIOFile_FileTime.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_FileTime_Async.cs b/src/QuickIO/QuickIOFile_FileTime_Async.cs index 003c26c..e60c222 100644 --- a/src/QuickIO/QuickIOFile_FileTime_Async.cs +++ b/src/QuickIO/QuickIOFile_FileTime_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_Root.cs b/src/QuickIO/QuickIOFile_Root.cs index 2829b5c..0858edf 100644 --- a/src/QuickIO/QuickIOFile_Root.cs +++ b/src/QuickIO/QuickIOFile_Root.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/src/QuickIO/QuickIOFile_Root_Async.cs b/src/QuickIO/QuickIOFile_Root_Async.cs index f2eb4fd..0b19bc1 100644 --- a/src/QuickIO/QuickIOFile_Root_Async.cs +++ b/src/QuickIO/QuickIOFile_Root_Async.cs @@ -1,4 +1,3 @@ - // ------------------------------------------------------------------------------ // // This code was generated by a T4 template. diff --git a/tests/QuickIO.IntegrationTests/QuickIO.IntegrationTests.csproj b/tests/QuickIO.IntegrationTests/QuickIO.IntegrationTests.csproj index 26528d5..4055f25 100644 --- a/tests/QuickIO.IntegrationTests/QuickIO.IntegrationTests.csproj +++ b/tests/QuickIO.IntegrationTests/QuickIO.IntegrationTests.csproj @@ -4,7 +4,6 @@ - @@ -15,7 +14,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/QuickIO.UnitTests/QuickIO.UnitTests.csproj b/tests/QuickIO.UnitTests/QuickIO.UnitTests.csproj index cef79a5..a7644a1 100644 --- a/tests/QuickIO.UnitTests/QuickIO.UnitTests.csproj +++ b/tests/QuickIO.UnitTests/QuickIO.UnitTests.csproj @@ -3,8 +3,7 @@ - - + @@ -15,33 +14,32 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - + - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + diff --git a/tests/QuickIO.UnitTests/QuickIO_Directory_Enumeration_Tests.cs b/tests/QuickIO.UnitTests/QuickIO_Directory_Enumeration_Tests.cs index b01762d..c86999d 100644 --- a/tests/QuickIO.UnitTests/QuickIO_Directory_Enumeration_Tests.cs +++ b/tests/QuickIO.UnitTests/QuickIO_Directory_Enumeration_Tests.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using FluentAssertions; using Xunit; namespace SchwabenCode.QuickIO.UnitTests; @@ -96,7 +95,7 @@ public void Directory_AttrFail_Test() { string testfile = Path.Combine( Path.GetFullPath( "TestFiles/" ), "AttrFail_" + Path.GetRandomFileName( ) ); - Action act = () => QuickIODirectory.GetAttributes(testfile).HasFlag(FileAttributes.Hidden); - act.Should().Throw(); + Assert.Throws(() => QuickIODirectory.GetAttributes(testfile).HasFlag(FileAttributes.Hidden)); } } + diff --git a/tests/QuickIO.UnitTests/QuickIO_Directory_Tests.cs b/tests/QuickIO.UnitTests/QuickIO_Directory_Tests.cs index 875c184..3745307 100644 --- a/tests/QuickIO.UnitTests/QuickIO_Directory_Tests.cs +++ b/tests/QuickIO.UnitTests/QuickIO_Directory_Tests.cs @@ -1,5 +1,4 @@ -using FluentAssertions; -using Xunit; +using Xunit; namespace SchwabenCode.QuickIO.UnitTests; @@ -69,16 +68,16 @@ public void Directory_Exists_Test() [Fact] public void Directory_SetWriteTime_Test() { - string currentDirc = Path.GetFullPath( "TestFiles/DirTimeTest" ); - QuickIODirectoryInfo dirInfo = new( currentDirc ); + string currentDirc = Path.GetFullPath("TestFiles/DirTimeTest"); + QuickIODirectoryInfo dirInfo = new(currentDirc); - DateTime newTime = DateTime.Now.AddDays( -1 ); + DateTime newTime = DateTime.Now.AddDays(-1); QuickIODirectory.SetAllFileTimesUtc(dirInfo, newTime, newTime, newTime); - QuickIODirectory.GetLastWriteTime(dirInfo).Should().Be(newTime); - QuickIODirectory.GetLastAccessTime(dirInfo).Should().Be(newTime); - QuickIODirectory.GetCreationTime(dirInfo).Should().Be(newTime); + Assert.Equal(newTime, QuickIODirectory.GetLastWriteTime(dirInfo)); + Assert.Equal(newTime, QuickIODirectory.GetLastAccessTime(dirInfo)); + Assert.Equal(newTime, QuickIODirectory.GetCreationTime(dirInfo)); } // TODO diff --git a/tests/QuickIO.UnitTests/QuickIO_File_Tests.cs b/tests/QuickIO.UnitTests/QuickIO_File_Tests.cs index 3a55e78..c521b53 100644 --- a/tests/QuickIO.UnitTests/QuickIO_File_Tests.cs +++ b/tests/QuickIO.UnitTests/QuickIO_File_Tests.cs @@ -41,7 +41,7 @@ public void File_AppendAllLines_Test() Assert.Equal(test[1], result[1]); // Append - QuickIOFile.AppendAllLines(file, new List() { test[2] }); + QuickIOFile.AppendAllLines(file, [test[2]]); Assert.Equal(test[0], result[0]); Assert.Equal(test[1], result[1]); Assert.Equal(test[2], result[2]); diff --git a/tests/QuickIO.UnitTests/QuickIO_PathInfo_Tests.cs b/tests/QuickIO.UnitTests/QuickIO_PathInfo_Tests.cs index 4bd3d71..e53750b 100644 --- a/tests/QuickIO.UnitTests/QuickIO_PathInfo_Tests.cs +++ b/tests/QuickIO.UnitTests/QuickIO_PathInfo_Tests.cs @@ -1,5 +1,4 @@ -using FluentAssertions; -using Xunit; +using Xunit; namespace SchwabenCode.QuickIO.UnitTests; @@ -9,36 +8,36 @@ public class QuickIO_PathInfo_Tests [Fact] public void QuickIOPathInfo_Create_Object_CTor_LocalFile_Test() { - QuickIOPathInfo pathInfo = new( @"C:\temp\file.txt" ); + QuickIOPathInfo pathInfo = new(@"C:\temp\file.txt"); - pathInfo.FullName.Should().Be(@"C:\temp\file.txt"); - pathInfo.FullNameUnc.Should().Be(QuickIOPath.UncLocalPathPrefix + @"C:\temp\file.txt"); + Assert.Equal(@"C:\temp\file.txt", pathInfo.FullName); + Assert.Equal(QuickIOPath.UncLocalPathPrefix + @"C:\temp\file.txt", pathInfo.FullNameUnc); } [Fact] public void QuickIOPathInfo_Create_Object_CTor_LocalFolder_Test() { - QuickIOPathInfo pathInfo = new( @"C:\temp" ); + QuickIOPathInfo pathInfo = new(@"C:\temp"); - pathInfo.FullName.Should().Be(@"C:\temp"); - pathInfo.FullNameUnc.Should().Be(QuickIOPath.UncLocalPathPrefix + @"C:\temp"); + Assert.Equal(@"C:\temp", pathInfo.FullName); + Assert.Equal(QuickIOPath.UncLocalPathPrefix + @"C:\temp", pathInfo.FullNameUnc); } [Fact] public void QuickIOPathInfo_Create_Object_CTor_ShareFile_Test() { - QuickIOPathInfo pathInfo = new( @"\\server\share\file.txt" ); + QuickIOPathInfo pathInfo = new(@"\\server\share\file.txt"); - pathInfo.FullName.Should().Be(@"\\server\share\file.txt"); - pathInfo.FullNameUnc.Should().Be(QuickIOPath.UncSharePathPrefix + @"server\share\file.txt"); + Assert.Equal(@"\\server\share\file.txt", pathInfo.FullName); + Assert.Equal(QuickIOPath.UncSharePathPrefix + @"server\share\file.txt", pathInfo.FullNameUnc); } [Fact] public void QuickIOPathInfo_Create_Object_CTor_ShareFolder_Test() { - QuickIOPathInfo pathInfo = new( @"\\server\share" ); + QuickIOPathInfo pathInfo = new(@"\\server\share"); - pathInfo.FullName.Should().Be(@"\\server\share"); - pathInfo.FullNameUnc.Should().Be(QuickIOPath.UncSharePathPrefix + @"server\share"); + Assert.Equal(@"\\server\share", pathInfo.FullName); + Assert.Equal(QuickIOPath.UncSharePathPrefix + @"server\share", pathInfo.FullNameUnc); } } diff --git a/tests/QuickIO.UnitTests/QuickIO_Transfer_CopyJob.cs b/tests/QuickIO.UnitTests/QuickIO_Transfer_CopyJob.cs index 5c932ee..a84e106 100644 --- a/tests/QuickIO.UnitTests/QuickIO_Transfer_CopyJob.cs +++ b/tests/QuickIO.UnitTests/QuickIO_Transfer_CopyJob.cs @@ -1,17 +1,19 @@ -using SchwabenCode.QuickIO.Transfer; -using Xunit; +// this will be replace with a mock soon -namespace SchwabenCode.QuickIO.UnitTests; +//using SchwabenCode.QuickIO.Transfer; +//using Xunit; -public class QuickIO_Transfer_CopyJob -{ - [Fact] - public void TestCopyJob_1() - { - string testFile = Path.GetFullPath( @"TestFiles\Test.txt" ); - string target = @"D:\testfile.txt"; +//namespace SchwabenCode.QuickIO.UnitTests; - QuickIOTransferFileCopyJob copyJob = new( testFile, target, 65535, overwrite: true ); - copyJob.Run(); - } -} +//public class QuickIO_Transfer_CopyJob +//{ +// [Fact] +// public void TestCopyJob_1() +// { +// string testFile = Path.GetFullPath( @"TestFiles\Test.txt" ); +// string target = @"D:\testfile.txt"; + +// QuickIOTransferFileCopyJob copyJob = new( testFile, target, 65535, overwrite: true ); +// copyJob.Run(); +// } +//} diff --git a/tests/QuickIO.UnitTests/RandomTestFileProvider.cs b/tests/QuickIO.UnitTests/RandomTestFileProvider.cs index bf9064d..46cb5da 100644 --- a/tests/QuickIO.UnitTests/RandomTestFileProvider.cs +++ b/tests/QuickIO.UnitTests/RandomTestFileProvider.cs @@ -47,4 +47,4 @@ public void Dispose() } } } -} \ No newline at end of file +} From 35fc970eb21866bcee0ccd0365423c8bc9dc8b2b Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Thu, 16 Jan 2025 16:47:07 +0100 Subject: [PATCH 2/5] add sdk install --- .github/workflows/main.yml | 11 ++++++++--- Directory.Build.props | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 82c0bc3..38f5cd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,10 +25,15 @@ jobs: with: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - - name: 'Install .NET SDK' - uses: actions/setup-dotnet@v4 + - name: Setup .NET SDK 7.x + uses: actions/setup-dotnet@v3 with: - global-json-file: ./global.json + dotnet-version: '7.x' + + - name: Setup .NET SDK 8.x + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '8.x' - name: Versioning uses: dotnet/nbgv@master diff --git a/Directory.Build.props b/Directory.Build.props index ccb44a4..d537a9a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ - net7.0-windows;net8.0-windows + net7.0-windows;net8.0-windows;net9.0-windows $(GlobalNamespacePrefix).$(MSBuildProjectName) $(GlobalAssemblyNamePrefix).$(MSBuildProjectName) From f4cfeb232111b53b1ef2e2c75fdd96fc939c752e Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Thu, 16 Jan 2025 16:49:24 +0100 Subject: [PATCH 3/5] add sdk install --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 38f5cd5..c117742 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,6 +35,11 @@ jobs: with: dotnet-version: '8.x' + - name: Setup .NET SDK 9.x + uses: actions/setup-dotnet@v3 + with: + dotnet-version: '9.x' + - name: Versioning uses: dotnet/nbgv@master id: nbgv From 247ee9a77953493c0c9b6416862d3ddf5f384e1a Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Thu, 16 Jan 2025 16:50:21 +0100 Subject: [PATCH 4/5] add sdk install --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c117742..8cdcdeb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,10 +35,10 @@ jobs: with: dotnet-version: '8.x' - - name: Setup .NET SDK 9.x - uses: actions/setup-dotnet@v3 + - name: 'Install .NET Global.json SDK' # is always the latest + uses: actions/setup-dotnet@v4 with: - dotnet-version: '9.x' + global-json-file: ./global.json - name: Versioning uses: dotnet/nbgv@master From 2c319ef8cd2ca636d5e8029ee0d299cc10584cc5 Mon Sep 17 00:00:00 2001 From: BEN ABT Date: Thu, 16 Jan 2025 16:50:41 +0100 Subject: [PATCH 5/5] use v4 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8cdcdeb..ffd850c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,12 +26,12 @@ jobs: fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: Setup .NET SDK 7.x - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: '7.x' - name: Setup .NET SDK 8.x - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: '8.x'