Skip to content

Commit

Permalink
Merge pull request #27 from SchwabenCode/feature/update-nuget-refs
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAbt authored Jan 16, 2025
2 parents 4ea5490 + 2c319ef commit 251fd16
Show file tree
Hide file tree
Showing 24 changed files with 117 additions and 130 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ jobs:
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: 'Install .NET SDK'
- name: Setup .NET SDK 7.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.x'

- name: Setup .NET SDK 8.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: 'Install .NET Global.json SDK' # is always the latest
uses: actions/setup-dotnet@v4
with:
global-json-file: ./global.json
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</PropertyGroup>

<PropertyGroup Label="Project">
<TargetFrameworks>net7.0-windows;net8.0-windows</TargetFrameworks>
<TargetFrameworks>net7.0-windows;net8.0-windows;net9.0-windows</TargetFrameworks>
<RootNamespace>$(GlobalNamespacePrefix).$(MSBuildProjectName)</RootNamespace>
<AssemblyName>$(GlobalAssemblyNamePrefix).$(MSBuildProjectName)</AssemblyName>
</PropertyGroup>
Expand Down
94 changes: 44 additions & 50 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,52 +1,46 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup Label=".NET">
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="T4.Build" Version="0.2.4" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Label="Analyzers">
<PackageVersion Include="Roslynator.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.5.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.149">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>

<ItemGroup Label="DevOps">
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>

<ItemGroup Label="Tests">
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="MSTest.TestFramework" Version="3.5.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="NSubstitute" Version="5.0.0" />
<PackageVersion Include="xunit" Version="2.6.3" />
<PackageVersion Include="xunit.runner.console" Version="2.6.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="coverlet.msbuild" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Label=".NET">
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="T4.Build" Version="0.2.5" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Label="Analyzers">
<PackageVersion Include="Roslynator.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="4.5.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.149">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>
<ItemGroup Label="DevOps">
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>
<ItemGroup Label="Tests">
<PackageVersion Include="MSTest.TestFramework" Version="3.5.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.console" Version="2.9.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="coverlet.msbuild" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "9.0.100-preview.7.24407.12"
"version": "9.0.102"
}
}
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_Attributes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_Attributes_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_FileTime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_FileTime_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_Root.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIODirectory_Root_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_Attributes.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_Attributes_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_FileTime.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_FileTime_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_Root.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
1 change: 0 additions & 1 deletion src/QuickIO/QuickIOFile_Root_Async.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a T4 template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />

<PackageReference Include="Moq" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.console">
Expand All @@ -15,7 +14,6 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="NSubstitute" />
</ItemGroup>

Expand Down
42 changes: 20 additions & 22 deletions tests/QuickIO.UnitTests/QuickIO.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<ItemGroup>
<PackageReference Include="System.Net.Http" />
<PackageReference Include="System.Text.RegularExpressions" />

<PackageReference Include="Moq" />

<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.console">
Expand All @@ -15,33 +14,32 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="NSubstitute" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\QuickIO\QuickIO.csproj" />
<ProjectReference Include="..\..\src\QuickIO\QuickIO.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="TestFiles\DirTimeTest\File.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\HiddenFile.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Overwrites\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Overwrites\TestDir\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\ReadonlyFile.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\DirTimeTest\File.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\HiddenFile.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Overwrites\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Overwrites\TestDir\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\ReadonlyFile.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\Test.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using FluentAssertions;
using Xunit;

namespace SchwabenCode.QuickIO.UnitTests;
Expand Down Expand Up @@ -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<PathNotFoundException>();
Assert.Throws<PathNotFoundException>(() => QuickIODirectory.GetAttributes(testfile).HasFlag(FileAttributes.Hidden));
}
}

15 changes: 7 additions & 8 deletions tests/QuickIO.UnitTests/QuickIO_Directory_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FluentAssertions;
using Xunit;
using Xunit;

namespace SchwabenCode.QuickIO.UnitTests;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/QuickIO.UnitTests/QuickIO_File_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void File_AppendAllLines_Test()
Assert.Equal(test[1], result[1]);

// Append
QuickIOFile.AppendAllLines(file, new List<string>() { 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]);
Expand Down
27 changes: 13 additions & 14 deletions tests/QuickIO.UnitTests/QuickIO_PathInfo_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using FluentAssertions;
using Xunit;
using Xunit;

namespace SchwabenCode.QuickIO.UnitTests;

Expand All @@ -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);
}
}
Loading

0 comments on commit 251fd16

Please sign in to comment.