Skip to content

Commit

Permalink
refactor: update and simplify references (#737)
Browse files Browse the repository at this point in the history
Remove reference to "TestableIO.System.IO.Abstractions" and "Testably.Abstractions.FluentAssertions"
Update references for "aweXpect" and "aweXpect.Testably"

Adapt tests accordingly
  • Loading branch information
vbreuss authored Jan 30, 2025
1 parent 636dd17 commit 1aef964
Show file tree
Hide file tree
Showing 95 changed files with 659 additions and 702 deletions.
6 changes: 2 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<PackageVersion Include="DotNet.Glob" Version="3.1.3"/>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageVersion Include="System.Linq.Async" Version="6.0.1"/>
<PackageVersion Include="TestableIO.System.IO.Abstractions" Version="21.3.1"/>
<PackageVersion Include="System.IO.Compression" Version="4.3.0"/>
<PackageVersion Include="System.IO.FileSystem.AccessControl" Version="5.0.0"/>
</ItemGroup>
Expand Down Expand Up @@ -36,8 +35,8 @@
<ItemGroup>
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="5.0.0-preview0012"/>
<PackageVersion Include="AutoFixture.Xunit3" Version="5.0.0-preview0012"/>
<PackageVersion Include="aweXpect" Version="0.20.0"/>
<PackageVersion Include="aweXpect.Testably" Version="0.3.0"/>
<PackageVersion Include="aweXpect" Version="0.22.0"/>
<PackageVersion Include="aweXpect.Testably" Version="0.4.0"/>
<PackageVersion Include="FluentAssertions" Version="7.1.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageVersion Include="xunit.v3" Version="1.0.1"/>
Expand All @@ -51,7 +50,6 @@
<ItemGroup>
<PackageVersion Include="Testably.Abstractions" Version="3.2.4"/>
<PackageVersion Include="Testably.Abstractions.Testing" Version="3.2.4"/>
<PackageVersion Include="Testably.Abstractions.FluentAssertions" Version="1.1.0"/>
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.186"/>
Expand Down
25 changes: 18 additions & 7 deletions Pipeline/Build.Compile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ partial class Build
Solution.Testably_Abstractions_Interface,
Solution.Testably_Abstractions_FileSystem_Interface,
];

string preRelease = "-CI";
if (GitHubActions == null)
{
preRelease = "-DEV";
}
else if (GitHubActions.Ref.StartsWith("refs/tags/", StringComparison.OrdinalIgnoreCase) == true)
{
int preReleaseIndex = GitHubActions.Ref.IndexOf('-');
preRelease = preReleaseIndex > 0 ? GitHubActions.Ref[preReleaseIndex..] : "";
}

CoreVersion = AssemblyVersion.FromGitVersion(GitVersionTasks.GitVersion(s => s
.SetFramework("net8.0")
Expand All @@ -52,7 +63,7 @@ partial class Build
.DisableProcessOutputLogging()
.SetUpdateAssemblyInfo(false)
.AddProcessAdditionalArguments("/overrideconfig", "tag-prefix=core/v"))
.Result);
.Result, preRelease);

GitVersion gitVersion = GitVersionTasks.GitVersion(s => s
.SetFramework("net8.0")
Expand All @@ -62,7 +73,7 @@ partial class Build
.SetUpdateAssemblyInfo(false))
.Result;

MainVersion = AssemblyVersion.FromGitVersion(gitVersion);
MainVersion = AssemblyVersion.FromGitVersion(gitVersion, preRelease);
SemVer = gitVersion.SemVer;
BranchName = gitVersion.BranchName;

Expand Down Expand Up @@ -121,7 +132,7 @@ partial class Build
.SetConfiguration(Configuration)
.EnableNoLogo()
.EnableNoRestore()
.SetVersion(MainVersion!.FileVersion)
.SetVersion(MainVersion!.FileVersion + CoreVersion.PreRelease)

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / API tests

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Static code analysis

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (windows-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (macos-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Pack

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Static code analysis

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (windows-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / API tests

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Unit tests (macos-latest)

Dereference of a possibly null reference.

Check warning on line 135 in Pipeline/Build.Compile.cs

View workflow job for this annotation

GitHub Actions / Pack

Dereference of a possibly null reference.
.SetAssemblyVersion(MainVersion!.FileVersion)
.SetFileVersion(MainVersion!.FileVersion));

Expand All @@ -135,23 +146,23 @@ partial class Build
.EnableNoLogo()
.EnableNoRestore()
.SetProcessAdditionalArguments($"/p:SolutionDir={RootDirectory}/")
.SetVersion(CoreVersion!.FileVersion)
.SetVersion(CoreVersion!.FileVersion + CoreVersion.PreRelease)
.SetAssemblyVersion(CoreVersion!.FileVersion)
.SetFileVersion(CoreVersion!.FileVersion));
}
});

public record AssemblyVersion(string FileVersion, string InformationalVersion)
public record AssemblyVersion(string FileVersion, string InformationalVersion, string PreRelease)
{
[return: NotNullIfNotNull(nameof(gitVersion))]
public static AssemblyVersion? FromGitVersion(GitVersion gitVersion)
public static AssemblyVersion? FromGitVersion(GitVersion gitVersion, string preRelease)
{
if (gitVersion is null)
{
return null;
}

return new AssemblyVersion(gitVersion.AssemblySemVer, gitVersion.InformationalVersion);
return new AssemblyVersion(gitVersion.AssemblySemVer, gitVersion.InformationalVersion, preRelease);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FileSystemStream New(string path, FileMode mode, FileAccess access,
FileSystemStream New(string path, FileMode mode, FileAccess access,
FileShare share, int bufferSize, FileOptions options);

#if FEATURE_FILESTREAM_OPTIONS
#if FEATURE_FILESYSTEM_STREAM_OPTIONS
/// <inheritdoc cref="FileStream(string, FileStreamOptions)" />
FileSystemStream New(string path, FileStreamOptions options);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface IFileSystemInfo
/// <inheritdoc cref="FileSystemInfo.LastWriteTimeUtc" />
DateTime LastWriteTimeUtc { get; set; }

#if FEATURE_FILE_SYSTEM_INFO_LINK_TARGET
#if FEATURE_FILESYSTEM_LINK
/// <inheritdoc cref="FileSystemInfo.LinkTarget" />
string? LinkTarget { get; }
#endif
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="TestableIO.System.IO.Abstractions" />
<ProjectReference Include="..\Testably.Abstractions.FileSystem.Interface\Testably.Abstractions.FileSystem.Interface.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ namespace System.IO.Abstractions
{
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileStreamOptions options);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync);
Expand Down Expand Up @@ -318,6 +319,7 @@ namespace System.IO.Abstractions
System.DateTime LastAccessTimeUtc { get; set; }
System.DateTime LastWriteTime { get; set; }
System.DateTime LastWriteTimeUtc { get; set; }
string? LinkTarget { get; }
string Name { get; }
void CreateAsSymbolicLink(string pathToTarget);
void Delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ namespace System.IO.Abstractions
{
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileStreamOptions options);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync);
Expand Down Expand Up @@ -344,6 +345,7 @@ namespace System.IO.Abstractions
System.DateTime LastAccessTimeUtc { get; set; }
System.DateTime LastWriteTime { get; set; }
System.DateTime LastWriteTimeUtc { get; set; }
string? LinkTarget { get; }
string Name { get; }
[set: System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
System.IO.UnixFileMode UnixFileMode { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ namespace System.IO.Abstractions
{
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileStreamOptions options);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize);
System.IO.Abstractions.FileSystemStream New(string path, System.IO.FileMode mode, System.IO.FileAccess access);
System.IO.Abstractions.FileSystemStream New(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync);
Expand Down Expand Up @@ -358,6 +359,7 @@ namespace System.IO.Abstractions
System.DateTime LastAccessTimeUtc { get; set; }
System.DateTime LastWriteTime { get; set; }
System.DateTime LastWriteTimeUtc { get; set; }
string? LinkTarget { get; }
string Name { get; }
[set: System.Runtime.Versioning.UnsupportedOSPlatform("windows")]
System.IO.UnixFileMode UnixFileMode { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ namespace Testably.Abstractions
Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; }
}
}
namespace Testably.Abstractions.Polyfills
{
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=false)]
public sealed class SupportedOSPlatformAttribute : System.Attribute
{
public SupportedOSPlatformAttribute(string platformName) { }
public string PlatformName { get; }
}
}
namespace Testably.Abstractions.RandomSystem
{
public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ namespace Testably.Abstractions
Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; }
}
}
namespace Testably.Abstractions.Polyfills
{
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=false)]
public sealed class SupportedOSPlatformAttribute : System.Attribute
{
public SupportedOSPlatformAttribute(string platformName) { }
public string PlatformName { get; }
}
}
namespace Testably.Abstractions.RandomSystem
{
public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<ItemGroup>
<PackageReference Include="PublicApiGenerator" />
<PackageReference Include="TestableIO.System.IO.Abstractions" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public async Task GetAccessControl_ShouldReturnSetResult()
DirectorySecurity result =
FileSystem.Directory.GetAccessControl("foo");

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -108,7 +108,7 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
DirectorySecurity result =
FileSystem.Directory.GetAccessControl("foo", AccessControlSections.None);

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -150,8 +150,8 @@ public async Task SetAccessControl_ShouldNotUpdateTimes()
DateTime lastAccessTimeUtc = FileSystem.File.GetLastAccessTimeUtc("foo.txt");
DateTime lastWriteTimeUtc = FileSystem.File.GetLastWriteTimeUtc("foo.txt");

await That(creationTimeUtc).Is(previousCreationTimeUtc);
await That(lastAccessTimeUtc).Is(previousLastAccessTimeUtc);
await That(lastWriteTimeUtc).Is(previousLastWriteTimeUtc);
await That(creationTimeUtc).IsEqualTo(previousCreationTimeUtc);
await That(lastAccessTimeUtc).IsEqualTo(previousLastAccessTimeUtc);
await That(lastWriteTimeUtc).IsEqualTo(previousLastWriteTimeUtc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public async Task GetAccessControl_ShouldReturnSetResult()
DirectorySecurity result =
FileSystem.DirectoryInfo.New("foo").GetAccessControl();

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -141,7 +141,7 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
DirectorySecurity result =
FileSystem.DirectoryInfo.New("foo").GetAccessControl(AccessControlSections.None);

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -184,8 +184,8 @@ public async Task SetAccessControl_ShouldNotUpdateTimes(string path)
DateTime lastAccessTimeUtc = FileSystem.File.GetLastAccessTimeUtc(path);
DateTime lastWriteTimeUtc = FileSystem.File.GetLastWriteTimeUtc(path);

await That(creationTimeUtc).Is(previousCreationTimeUtc);
await That(lastAccessTimeUtc).Is(previousLastAccessTimeUtc);
await That(lastWriteTimeUtc).Is(previousLastWriteTimeUtc);
await That(creationTimeUtc).IsEqualTo(previousCreationTimeUtc);
await That(lastAccessTimeUtc).IsEqualTo(previousLastAccessTimeUtc);
await That(lastWriteTimeUtc).IsEqualTo(previousLastWriteTimeUtc);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ await That(exception).IsNull().Because(
case MethodType.GetAccessControl:
await That(exception).Is<DirectoryNotFoundException>()
.Because($"\n{exceptionType} on {baseType}\n was called with a missing directory")
.Which(e => e.HResult, h => h.Is(-2147024893));
.Which(e => e.HResult, h => h.IsEqualTo(-2147024893));
break;
case MethodType.SetAccessControl:
await That(exception).IsNull()
Expand Down Expand Up @@ -68,7 +68,7 @@ await That(exception).IsNull()
case MethodType.GetAccessControl:
await That(exception).Is<DirectoryNotFoundException>()
.Because($"\n{exceptionType} on {baseType}\n was called with a missing file")
.Which(e => e.HResult, h => h.Is(-2147024893));
.Which(e => e.HResult, h => h.IsEqualTo(-2147024893));
break;
case MethodType.SetAccessControl:
await That(exception).IsNull()
Expand Down Expand Up @@ -99,12 +99,12 @@ public async Task FileOperations_WhenDirectoryIsMissing_ShouldThrowDirectoryNotF
case MethodType.Create:
await That(exception).Is<UnauthorizedAccessException>()
.Because($"\n{exceptionType} on {baseType}\n was called with a missing directory")
.Which(e => e.HResult, h => h.Is(-2147024891));
.Which(e => e.HResult, h => h.IsEqualTo(-2147024891));
break;
case MethodType.GetAccessControl:
await That(exception).Is<FileNotFoundException>()
.Because($"\n{exceptionType} on {baseType}\n was called with a missing directory")
.Which(e => e.HResult, h => h.Is(-2147024894));
.Which(e => e.HResult, h => h.IsEqualTo(-2147024894));
break;
case MethodType.SetAccessControl:
await That(exception).IsNull()
Expand Down Expand Up @@ -139,7 +139,7 @@ await That(exception).IsNull()
case MethodType.GetAccessControl:
await That(exception).Is<FileNotFoundException>()
.Because($"\n{exceptionType} on {baseType}\n was called with a missing file")
.Which(e => e.HResult, h => h.Is(-2147024894));
.Which(e => e.HResult, h => h.IsEqualTo(-2147024894));
break;
case MethodType.SetAccessControl:
await That(exception).IsNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task GetAccessControl_ShouldReturnSetResult()
FileSecurity result =
FileSystem.File.GetAccessControl("foo");

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -107,7 +107,7 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
FileSecurity result =
FileSystem.File.GetAccessControl("foo", AccessControlSections.None);

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public async Task GetAccessControl_ShouldReturnSetResult()
FileSecurity result =
FileSystem.FileInfo.New("foo").GetAccessControl();

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task GetAccessControl_WithAccessControlSections_ShouldReturnSetResu
FileSecurity result =
FileSystem.FileInfo.New("foo").GetAccessControl(AccessControlSections.None);

await That(result).Is(originalResult);
await That(result).IsEqualTo(originalResult);
#pragma warning restore CA1416
}

Expand Down
Loading

0 comments on commit 1aef964

Please sign in to comment.