diff --git a/README.md b/README.md
index e367af4..6c52e41 100644
--- a/README.md
+++ b/README.md
@@ -202,29 +202,43 @@ fileSystem.File.WriteAllText("Acme.dll", "");
IFileVersionInfo info = fileSystem.FileVersionInfo.GetVersionInfo("Acme.dll");
await That(info).HasCompanyName("Acme").And.HasProductName("Anvil");
-await That(info).HasFileVersion("1.2.3.4");
+await That(info).HasFileVersion("1.2.3.4").And.HasFileMajorPart(1);
await That(info).IsDebug().And.IsNotPreRelease();
```
-Dedicated assertions exist for the common fields (`HasCompanyName`,
-`HasProductName`, `HasFileDescription`, `HasFileVersion`, `HasProductVersion`,
-`HasOriginalFilename`, `HasLanguage`), plus the boolean pairs
-`IsDebug` / `IsNotDebug`, `IsPreRelease` / `IsNotPreRelease` and
-`IsPatched` / `IsNotPatched`.
-
-| Property | Assertion |
-|-----------------------|--------------------------------------------|
-| `CompanyName` | `HasCompanyName(string)` |
-| `ProductName` | `HasProductName(string)` |
-| `FileDescription` | `HasFileDescription(string)` |
-| `FileVersion` | `HasFileVersion(string)` |
-| `ProductVersion` | `HasProductVersion(string)` |
-| `OriginalFilename` | `HasOriginalFilename(string)` |
-| `Language` | `HasLanguage(string)` |
-| `IsDebug` | `IsDebug()` / `IsNotDebug()` |
-| `IsPreRelease` | `IsPreRelease()` / `IsNotPreRelease()` |
-| `IsPatched` | `IsPatched()` / `IsNotPatched()` |
-| _other_ (e.g. `Comments`, `LegalCopyright`, `FileMajorPart`) | `await That(info.X).Is…` |
+Dedicated assertions cover every `IFileVersionInfo` property — strings via
+`Has…(string)`, the integer version parts via `Has…(int)` and the booleans
+as `Is…()` / `IsNot…()` pairs.
+
+| Property | Assertion |
+|----------------------|--------------------------------------------|
+| `Comments` | `HasComments(string)` |
+| `CompanyName` | `HasCompanyName(string)` |
+| `FileDescription` | `HasFileDescription(string)` |
+| `FileName` | `HasFileName(string)` |
+| `FileVersion` | `HasFileVersion(string)` |
+| `InternalName` | `HasInternalName(string)` |
+| `Language` | `HasLanguage(string)` |
+| `LegalCopyright` | `HasLegalCopyright(string)` |
+| `LegalTrademarks` | `HasLegalTrademarks(string)` |
+| `OriginalFilename` | `HasOriginalFilename(string)` |
+| `PrivateBuild` | `HasPrivateBuild(string)` |
+| `ProductName` | `HasProductName(string)` |
+| `ProductVersion` | `HasProductVersion(string)` |
+| `SpecialBuild` | `HasSpecialBuild(string)` |
+| `FileBuildPart` | `HasFileBuildPart(int)` |
+| `FileMajorPart` | `HasFileMajorPart(int)` |
+| `FileMinorPart` | `HasFileMinorPart(int)` |
+| `FilePrivatePart` | `HasFilePrivatePart(int)` |
+| `ProductBuildPart` | `HasProductBuildPart(int)` |
+| `ProductMajorPart` | `HasProductMajorPart(int)` |
+| `ProductMinorPart` | `HasProductMinorPart(int)` |
+| `ProductPrivatePart` | `HasProductPrivatePart(int)` |
+| `IsDebug` | `IsDebug()` / `IsNotDebug()` |
+| `IsPatched` | `IsPatched()` / `IsNotPatched()` |
+| `IsPreRelease` | `IsPreRelease()` / `IsNotPreRelease()` |
+| `IsPrivateBuild` | `IsPrivateBuild()` / `IsNotPrivateBuild()` |
+| `IsSpecialBuild` | `IsSpecialBuild()` / `IsNotSpecialBuild()` |
## File-system notifications
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasComments.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasComments.cs
new file mode 100644
index 0000000..f600bc1
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasComments.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the comments.
+ ///
+ public static StringEqualityTypeResult> HasComments(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.Comments, options, expected, "comments")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileBuildPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileBuildPart.cs
new file mode 100644
index 0000000..f456bad
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileBuildPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the file build part.
+ ///
+ public static AndOrResult> HasFileBuildPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.FileBuildPart, expected, "file build part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMajorPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMajorPart.cs
new file mode 100644
index 0000000..8eb3176
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMajorPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the file major part.
+ ///
+ public static AndOrResult> HasFileMajorPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.FileMajorPart, expected, "file major part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMinorPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMinorPart.cs
new file mode 100644
index 0000000..d9e5eb2
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileMinorPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the file minor part.
+ ///
+ public static AndOrResult> HasFileMinorPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.FileMinorPart, expected, "file minor part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileName.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileName.cs
new file mode 100644
index 0000000..163c06d
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFileName.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the file name.
+ ///
+ public static StringEqualityTypeResult> HasFileName(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.FileName, options, expected, "file name")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFilePrivatePart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFilePrivatePart.cs
new file mode 100644
index 0000000..8762088
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasFilePrivatePart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the file private part.
+ ///
+ public static AndOrResult> HasFilePrivatePart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.FilePrivatePart, expected, "file private part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasInternalName.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasInternalName.cs
new file mode 100644
index 0000000..e916ede
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasInternalName.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the internal name.
+ ///
+ public static StringEqualityTypeResult> HasInternalName(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.InternalName, options, expected, "internal name")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalCopyright.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalCopyright.cs
new file mode 100644
index 0000000..c03f6f5
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalCopyright.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the legal copyright.
+ ///
+ public static StringEqualityTypeResult> HasLegalCopyright(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.LegalCopyright, options, expected, "legal copyright")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalTrademarks.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalTrademarks.cs
new file mode 100644
index 0000000..e779a8c
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasLegalTrademarks.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the legal trademarks.
+ ///
+ public static StringEqualityTypeResult> HasLegalTrademarks(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.LegalTrademarks, options, expected, "legal trademarks")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasPrivateBuild.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasPrivateBuild.cs
new file mode 100644
index 0000000..35ed3a4
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasPrivateBuild.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the private build.
+ ///
+ public static StringEqualityTypeResult> HasPrivateBuild(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.PrivateBuild, options, expected, "private build")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductBuildPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductBuildPart.cs
new file mode 100644
index 0000000..bcf7a6c
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductBuildPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the product build part.
+ ///
+ public static AndOrResult> HasProductBuildPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.ProductBuildPart, expected, "product build part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMajorPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMajorPart.cs
new file mode 100644
index 0000000..e7ebcdb
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMajorPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the product major part.
+ ///
+ public static AndOrResult> HasProductMajorPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.ProductMajorPart, expected, "product major part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMinorPart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMinorPart.cs
new file mode 100644
index 0000000..2096905
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductMinorPart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the product minor part.
+ ///
+ public static AndOrResult> HasProductMinorPart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.ProductMinorPart, expected, "product minor part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductPrivatePart.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductPrivatePart.cs
new file mode 100644
index 0000000..b79a936
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasProductPrivatePart.cs
@@ -0,0 +1,21 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the product private part.
+ ///
+ public static AndOrResult> HasProductPrivatePart(
+ this IThat source,
+ int expected)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasInt32PropertyConstraint(
+ it, grammars, v => v.ProductPrivatePart, expected, "product private part")),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.HasSpecialBuild.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasSpecialBuild.cs
new file mode 100644
index 0000000..4a4ecaa
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.HasSpecialBuild.cs
@@ -0,0 +1,26 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Options;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the has the special build.
+ ///
+ public static StringEqualityTypeResult> HasSpecialBuild(
+ this IThat source,
+ string? expected)
+ {
+ StringEqualityOptions options = new();
+ return new StringEqualityTypeResult>(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasStringPropertyConstraint(
+ it, grammars, v => v.SpecialBuild, options, expected, "special build")),
+ source,
+ options);
+ }
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.IsPrivateBuild.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.IsPrivateBuild.cs
new file mode 100644
index 0000000..dd336ba
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.IsPrivateBuild.cs
@@ -0,0 +1,32 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Core.Constraints;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the is a private build.
+ ///
+ public static AndOrResult> IsPrivateBuild(
+ this IThat source)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasBoolPropertyConstraint(
+ it, grammars, v => v.IsPrivateBuild, "is private build", "is not private build")),
+ source);
+
+ ///
+ /// Verifies that the is not a private build.
+ ///
+ public static AndOrResult> IsNotPrivateBuild(
+ this IThat source)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasBoolPropertyConstraint(
+ it, grammars, v => v.IsPrivateBuild, "is private build", "is not private build").Invert()),
+ source);
+}
diff --git a/Source/aweXpect.Testably/FileVersionInfoExtensions.IsSpecialBuild.cs b/Source/aweXpect.Testably/FileVersionInfoExtensions.IsSpecialBuild.cs
new file mode 100644
index 0000000..4f515ee
--- /dev/null
+++ b/Source/aweXpect.Testably/FileVersionInfoExtensions.IsSpecialBuild.cs
@@ -0,0 +1,32 @@
+using System.IO.Abstractions;
+using aweXpect.Core;
+using aweXpect.Core.Constraints;
+using aweXpect.Results;
+using aweXpect.Testably.Helpers;
+
+namespace aweXpect.Testably;
+
+public static partial class FileVersionInfoExtensions
+{
+ ///
+ /// Verifies that the is a special build.
+ ///
+ public static AndOrResult> IsSpecialBuild(
+ this IThat source)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasBoolPropertyConstraint(
+ it, grammars, v => v.IsSpecialBuild, "is special build", "is not special build")),
+ source);
+
+ ///
+ /// Verifies that the is not a special build.
+ ///
+ public static AndOrResult> IsNotSpecialBuild(
+ this IThat source)
+ => new(
+ source.Get().ExpectationBuilder.AddConstraint((it, grammars)
+ => new FileVersionInfoConstraints.HasBoolPropertyConstraint(
+ it, grammars, v => v.IsSpecialBuild, "is special build", "is not special build").Invert()),
+ source);
+}
diff --git a/Source/aweXpect.Testably/Helpers/FileVersionInfoConstraints.cs b/Source/aweXpect.Testably/Helpers/FileVersionInfoConstraints.cs
index 47af7d6..ae817c5 100644
--- a/Source/aweXpect.Testably/Helpers/FileVersionInfoConstraints.cs
+++ b/Source/aweXpect.Testably/Helpers/FileVersionInfoConstraints.cs
@@ -70,6 +70,62 @@ protected override void AppendNegatedResult(StringBuilder stringBuilder, string?
}
}
+ internal sealed class HasInt32PropertyConstraint(
+ string it,
+ ExpectationGrammars grammars,
+ Func selector,
+ int expected,
+ string propertyName)
+ : ConstraintResult.WithValue(grammars),
+ IValueConstraint
+ {
+ private int _actualValue;
+
+ public ConstraintResult IsMetBy(IFileVersionInfo actual)
+ {
+ Actual = actual;
+ if (actual is null)
+ {
+ Outcome = Outcome.Failure;
+ return this;
+ }
+
+ _actualValue = selector(actual);
+ Outcome = _actualValue == expected ? Outcome.Success : Outcome.Failure;
+ return this;
+ }
+
+ protected override void AppendNormalExpectation(StringBuilder stringBuilder, string? indentation = null)
+ => stringBuilder.Append("has ").Append(propertyName).Append(' ').Append(expected);
+
+ protected override void AppendNormalResult(StringBuilder stringBuilder, string? indentation = null)
+ {
+ if (Actual is null)
+ {
+ stringBuilder.Append(it).Append(" was ");
+ }
+ else
+ {
+ stringBuilder.Append(it).Append(" was ").Append(_actualValue);
+ }
+ }
+
+ protected override void AppendNegatedExpectation(StringBuilder stringBuilder, string? indentation = null)
+ => stringBuilder.Append("does not have ").Append(propertyName).Append(' ').Append(expected);
+
+ protected override void AppendNegatedResult(StringBuilder stringBuilder, string? indentation = null)
+ {
+ if (Actual is null)
+ {
+ stringBuilder.Append(it).Append(" was ");
+ }
+ else
+ {
+ stringBuilder.Append(it).Append(" did");
+ }
+ }
+ }
+
internal sealed class HasBoolPropertyConstraint(
string it,
ExpectationGrammars grammars,
diff --git a/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoBucket.cs b/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoBucket.cs
index 9050472..9490a4a 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoBucket.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoBucket.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.IO.Abstractions;
using System.Runtime.CompilerServices;
using aweXpect.Core;
@@ -35,7 +36,8 @@ public RecordedDirectoryInfoInstance this[string path]
///
public RecordedMethodCallResult New(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectoryInfoFactory.New),
ParameterMatcher.From("path", path, pathExpression));
@@ -43,8 +45,9 @@ public RecordedMethodCallResult New(
/// Recorded calls to .
///
public RecordedMethodCallResult Wrap(
- Func? directoryInfo = null,
- [CallerArgumentExpression(nameof(directoryInfo))] string? directoryInfoExpression = null)
+ Func? directoryInfo = null,
+ [CallerArgumentExpression(nameof(directoryInfo))]
+ string? directoryInfoExpression = null)
=> Build(nameof(IDirectoryInfoFactory.Wrap),
ParameterMatcher.From("directoryInfo", directoryInfo, directoryInfoExpression));
diff --git a/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoInstance.cs b/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoInstance.cs
index 5150e5b..32de3ba 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoInstance.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedDirectoryInfoInstance.cs
@@ -15,9 +15,9 @@ namespace aweXpect.Testably.Recorded;
///
public sealed class RecordedDirectoryInfoInstance
{
- private readonly IThat _subject;
- private readonly string _path;
private readonly string _bucketDescription;
+ private readonly string _path;
+ private readonly IThat _subject;
internal RecordedDirectoryInfoInstance(IThat subject, string path)
{
@@ -26,6 +26,104 @@ internal RecordedDirectoryInfoInstance(IThat subject, str
_bucketDescription = $"DirectoryInfo[\"{path}\"]";
}
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Attributes
+ => Property(nameof(IFileSystemInfo.Attributes));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty CreationTime
+ => Property(nameof(IFileSystemInfo.CreationTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty CreationTimeUtc
+ => Property(nameof(IFileSystemInfo.CreationTimeUtc));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Exists
+ => Property(nameof(IFileSystemInfo.Exists));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Extension
+ => Property(nameof(IFileSystemInfo.Extension));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty FullName
+ => Property(nameof(IFileSystemInfo.FullName));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastAccessTime
+ => Property(nameof(IFileSystemInfo.LastAccessTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastAccessTimeUtc
+ => Property(nameof(IFileSystemInfo.LastAccessTimeUtc));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastWriteTime
+ => Property(nameof(IFileSystemInfo.LastWriteTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastWriteTimeUtc
+ => Property(nameof(IFileSystemInfo.LastWriteTimeUtc));
+
+ ///
+ /// Recorded accesses to IFileSystemInfo.LinkTarget.
+ ///
+ public RecordedProperty LinkTarget
+#if NET6_0_OR_GREATER
+ => Property(nameof(IFileSystemInfo.LinkTarget));
+#else
+ => Property("LinkTarget");
+#endif
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Name
+ => Property(nameof(IFileSystemInfo.Name));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Parent
+ => Property(nameof(IDirectoryInfo.Parent));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Root
+ => Property(nameof(IDirectoryInfo.Root));
+
+ ///
+ /// Recorded accesses to IFileSystemInfo.UnixFileMode.
+ ///
+ public RecordedProperty UnixFileMode
+#if NET7_0_OR_GREATER
+ => Property(nameof(IFileSystemInfo.UnixFileMode));
+#else
+ => Property("UnixFileMode");
+#endif
+
///
/// Recorded calls to .
///
@@ -37,7 +135,8 @@ public RecordedMethodCallResult Create()
///
public RecordedMethodCallResult CreateAsSymbolicLink(
Func? pathToTarget = null,
- [CallerArgumentExpression(nameof(pathToTarget))] string? pathToTargetExpression = null)
+ [CallerArgumentExpression(nameof(pathToTarget))]
+ string? pathToTargetExpression = null)
=> Build("CreateAsSymbolicLink",
ParameterMatcher.From("pathToTarget", pathToTarget, pathToTargetExpression));
@@ -46,7 +145,8 @@ public RecordedMethodCallResult CreateAsSymbolicLink(
///
public RecordedMethodCallResult CreateSubdirectory(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectoryInfo.CreateSubdirectory),
ParameterMatcher.From("path", path, pathExpression));
@@ -55,7 +155,8 @@ public RecordedMethodCallResult CreateSubdirectory(
///
public RecordedMethodCallResult Delete(
Func? recursive = null,
- [CallerArgumentExpression(nameof(recursive))] string? recursiveExpression = null)
+ [CallerArgumentExpression(nameof(recursive))]
+ string? recursiveExpression = null)
=> Build(nameof(IFileSystemInfo.Delete),
ParameterMatcher.From("recursive", recursive, recursiveExpression));
@@ -72,19 +173,21 @@ public RecordedMethodCallResult EnumerateDirectories(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.EnumerateDirectories),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to and overloads.
@@ -99,19 +202,21 @@ public RecordedMethodCallResult EnumerateFiles(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.EnumerateFiles),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to and overloads.
@@ -126,19 +231,21 @@ public RecordedMethodCallResult EnumerateFileSystemInfos(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.EnumerateFileSystemInfos),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to and overloads.
@@ -153,19 +260,21 @@ public RecordedMethodCallResult GetDirectories(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.GetDirectories),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to and overloads.
@@ -180,19 +289,21 @@ public RecordedMethodCallResult GetFiles(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.GetFiles),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to and overloads.
@@ -207,26 +318,29 @@ public RecordedMethodCallResult GetFileSystemInfos(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectoryInfo.GetFileSystemInfos),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
SearchOrEnumerationMatcher(searchOption, searchOptionExpression
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
///
/// Recorded calls to .
///
public RecordedMethodCallResult MoveTo(
Func? destDirName = null,
- [CallerArgumentExpression(nameof(destDirName))] string? destDirNameExpression = null)
+ [CallerArgumentExpression(nameof(destDirName))]
+ string? destDirNameExpression = null)
=> Build(nameof(IDirectoryInfo.MoveTo),
ParameterMatcher.From("destDirName", destDirName, destDirNameExpression));
@@ -241,108 +355,11 @@ public RecordedMethodCallResult Refresh()
///
public RecordedMethodCallResult ResolveLinkTarget(
Func? returnFinalTarget = null,
- [CallerArgumentExpression(nameof(returnFinalTarget))] string? returnFinalTargetExpression = null)
+ [CallerArgumentExpression(nameof(returnFinalTarget))]
+ string? returnFinalTargetExpression = null)
=> Build("ResolveLinkTarget",
ParameterMatcher.From("returnFinalTarget", returnFinalTarget, returnFinalTargetExpression));
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Attributes
- => Property(nameof(IFileSystemInfo.Attributes));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty CreationTime
- => Property(nameof(IFileSystemInfo.CreationTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty CreationTimeUtc
- => Property(nameof(IFileSystemInfo.CreationTimeUtc));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Exists
- => Property(nameof(IFileSystemInfo.Exists));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Extension
- => Property(nameof(IFileSystemInfo.Extension));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty FullName
- => Property(nameof(IFileSystemInfo.FullName));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastAccessTime
- => Property(nameof(IFileSystemInfo.LastAccessTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastAccessTimeUtc
- => Property(nameof(IFileSystemInfo.LastAccessTimeUtc));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastWriteTime
- => Property(nameof(IFileSystemInfo.LastWriteTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastWriteTimeUtc
- => Property(nameof(IFileSystemInfo.LastWriteTimeUtc));
-
- ///
- /// Recorded accesses to IFileSystemInfo.LinkTarget.
- ///
- public RecordedProperty LinkTarget
-#if NET6_0_OR_GREATER
- => Property(nameof(IFileSystemInfo.LinkTarget));
-#else
- => Property("LinkTarget");
-#endif
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Name
- => Property(nameof(IFileSystemInfo.Name));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Parent
- => Property(nameof(IDirectoryInfo.Parent));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Root
- => Property(nameof(IDirectoryInfo.Root));
-
- ///
- /// Recorded accesses to IFileSystemInfo.UnixFileMode.
- ///
- public RecordedProperty UnixFileMode
-#if NET7_0_OR_GREATER
- => Property(nameof(IFileSystemInfo.UnixFileMode));
-#else
- => Property("UnixFileMode");
-#endif
-
private RecordedProperty Property(string propertyName)
{
string path = _path;
@@ -356,7 +373,7 @@ private static ParameterMatcher SearchOrEnumerationMatcher(
, Func? enumerationOptions,
string? enumerationOptionsExpression
#endif
- )
+ )
{
#if NET6_0_OR_GREATER
if (enumerationOptions is not null)
diff --git a/Source/aweXpect.Testably/Recorded/RecordedDirectoryMethods.cs b/Source/aweXpect.Testably/Recorded/RecordedDirectoryMethods.cs
index 848118f..232f72b 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedDirectoryMethods.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedDirectoryMethods.cs
@@ -30,24 +30,27 @@ public RecordedMethodCallResult CreateDirectory(
#if NET7_0_OR_GREATER
Func? unixCreateMode = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null
#if NET7_0_OR_GREATER
, [CallerArgumentExpression(nameof(unixCreateMode))] string? unixCreateModeExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.CreateDirectory),
ParameterMatcher.From("path", path, pathExpression)
#if NET7_0_OR_GREATER
, ParameterMatcher.From("unixCreateMode", unixCreateMode, unixCreateModeExpression)
#endif
- );
+ );
/// Recorded calls to IDirectory.CreateSymbolicLink(string, string).
public RecordedMethodCallResult CreateSymbolicLink(
Func? path = null,
Func? pathToTarget = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(pathToTarget))] string? pathToTargetExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(pathToTarget))]
+ string? pathToTargetExpression = null)
=> Build("CreateSymbolicLink",
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("pathToTarget", pathToTarget, pathToTargetExpression));
@@ -55,7 +58,8 @@ public RecordedMethodCallResult CreateSymbolicLink(
/// Recorded calls to IDirectory.CreateTempSubdirectory(string?).
public RecordedMethodCallResult CreateTempSubdirectory(
Func? prefix = null,
- [CallerArgumentExpression(nameof(prefix))] string? prefixExpression = null)
+ [CallerArgumentExpression(nameof(prefix))]
+ string? prefixExpression = null)
=> Build("CreateTempSubdirectory",
ParameterMatcher.From("prefix", prefix, prefixExpression));
@@ -63,8 +67,10 @@ public RecordedMethodCallResult CreateTempSubdirectory(
public RecordedMethodCallResult Delete(
Func? path = null,
Func? recursive = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(recursive))] string? recursiveExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(recursive))]
+ string? recursiveExpression = null)
=> Build(nameof(IDirectory.Delete),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("recursive", recursive, recursiveExpression));
@@ -82,13 +88,16 @@ public RecordedMethodCallResult EnumerateDirectories(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.EnumerateDirectories),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -96,7 +105,7 @@ public RecordedMethodCallResult EnumerateDirectories(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to and overloads.
@@ -112,13 +121,16 @@ public RecordedMethodCallResult EnumerateFiles(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.EnumerateFiles),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -126,7 +138,7 @@ public RecordedMethodCallResult EnumerateFiles(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to and overloads.
@@ -142,13 +154,16 @@ public RecordedMethodCallResult EnumerateFileSystemEntries(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.EnumerateFileSystemEntries),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -156,27 +171,30 @@ public RecordedMethodCallResult EnumerateFileSystemEntries(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to .
public RecordedMethodCallResult Exists(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.Exists),
ParameterMatcher.From("path", path, pathExpression));
/// Recorded calls to .
public RecordedMethodCallResult GetCreationTime(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetCreationTime),
ParameterMatcher.From("path", path, pathExpression));
/// Recorded calls to .
public RecordedMethodCallResult GetCreationTimeUtc(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetCreationTimeUtc),
ParameterMatcher.From("path", path, pathExpression));
@@ -197,13 +215,16 @@ public RecordedMethodCallResult GetDirectories(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.GetDirectories),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -211,13 +232,14 @@ public RecordedMethodCallResult GetDirectories(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to .
public RecordedMethodCallResult GetDirectoryRoot(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetDirectoryRoot),
ParameterMatcher.From("path", path, pathExpression));
@@ -234,13 +256,16 @@ public RecordedMethodCallResult GetFiles(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.GetFiles),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -248,7 +273,7 @@ public RecordedMethodCallResult GetFiles(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to and overloads.
@@ -264,13 +289,16 @@ public RecordedMethodCallResult GetFileSystemEntries(
#if NET6_0_OR_GREATER
Func? enumerationOptions = null,
#endif
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(searchPattern))] string? searchPatternExpression = null,
- [CallerArgumentExpression(nameof(searchOption))] string? searchOptionExpression = null
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(searchPattern))]
+ string? searchPatternExpression = null,
+ [CallerArgumentExpression(nameof(searchOption))]
+ string? searchOptionExpression = null
#if NET6_0_OR_GREATER
, [CallerArgumentExpression(nameof(enumerationOptions))] string? enumerationOptionsExpression = null
#endif
- )
+ )
=> Build(nameof(IDirectory.GetFileSystemEntries),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("searchPattern", searchPattern, searchPatternExpression),
@@ -278,34 +306,38 @@ public RecordedMethodCallResult GetFileSystemEntries(
#if NET6_0_OR_GREATER
, enumerationOptions, enumerationOptionsExpression
#endif
- ));
+ ));
#pragma warning restore S107
/// Recorded calls to .
public RecordedMethodCallResult GetLastAccessTime(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetLastAccessTime),
ParameterMatcher.From("path", path, pathExpression));
/// Recorded calls to .
public RecordedMethodCallResult GetLastAccessTimeUtc(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetLastAccessTimeUtc),
ParameterMatcher.From("path", path, pathExpression));
/// Recorded calls to .
public RecordedMethodCallResult GetLastWriteTime(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetLastWriteTime),
ParameterMatcher.From("path", path, pathExpression));
/// Recorded calls to .
public RecordedMethodCallResult GetLastWriteTimeUtc(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetLastWriteTimeUtc),
ParameterMatcher.From("path", path, pathExpression));
@@ -316,7 +348,8 @@ public RecordedMethodCallResult GetLogicalDrives()
/// Recorded calls to .
public RecordedMethodCallResult GetParent(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.GetParent),
ParameterMatcher.From("path", path, pathExpression));
@@ -324,8 +357,10 @@ public RecordedMethodCallResult GetParent(
public RecordedMethodCallResult Move(
Func? sourceDirName = null,
Func? destDirName = null,
- [CallerArgumentExpression(nameof(sourceDirName))] string? sourceDirNameExpression = null,
- [CallerArgumentExpression(nameof(destDirName))] string? destDirNameExpression = null)
+ [CallerArgumentExpression(nameof(sourceDirName))]
+ string? sourceDirNameExpression = null,
+ [CallerArgumentExpression(nameof(destDirName))]
+ string? destDirNameExpression = null)
=> Build(nameof(IDirectory.Move),
ParameterMatcher.From("sourceDirName", sourceDirName, sourceDirNameExpression),
ParameterMatcher.From("destDirName", destDirName, destDirNameExpression));
@@ -334,8 +369,10 @@ public RecordedMethodCallResult Move(
public RecordedMethodCallResult ResolveLinkTarget(
Func? linkPath = null,
Func? returnFinalTarget = null,
- [CallerArgumentExpression(nameof(linkPath))] string? linkPathExpression = null,
- [CallerArgumentExpression(nameof(returnFinalTarget))] string? returnFinalTargetExpression = null)
+ [CallerArgumentExpression(nameof(linkPath))]
+ string? linkPathExpression = null,
+ [CallerArgumentExpression(nameof(returnFinalTarget))]
+ string? returnFinalTargetExpression = null)
=> Build("ResolveLinkTarget",
ParameterMatcher.From("linkPath", linkPath, linkPathExpression),
ParameterMatcher.From("returnFinalTarget", returnFinalTarget, returnFinalTargetExpression));
@@ -344,8 +381,10 @@ public RecordedMethodCallResult ResolveLinkTarget(
public RecordedMethodCallResult SetCreationTime(
Func? path = null,
Func? creationTime = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(creationTime))] string? creationTimeExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(creationTime))]
+ string? creationTimeExpression = null)
=> Build(nameof(IDirectory.SetCreationTime),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("creationTime", creationTime, creationTimeExpression));
@@ -354,8 +393,10 @@ public RecordedMethodCallResult SetCreationTime(
public RecordedMethodCallResult SetCreationTimeUtc(
Func? path = null,
Func? creationTimeUtc = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(creationTimeUtc))] string? creationTimeUtcExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(creationTimeUtc))]
+ string? creationTimeUtcExpression = null)
=> Build(nameof(IDirectory.SetCreationTimeUtc),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("creationTimeUtc", creationTimeUtc, creationTimeUtcExpression));
@@ -363,7 +404,8 @@ public RecordedMethodCallResult SetCreationTimeUtc(
/// Recorded calls to .
public RecordedMethodCallResult SetCurrentDirectory(
Func? path = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null)
=> Build(nameof(IDirectory.SetCurrentDirectory),
ParameterMatcher.From("path", path, pathExpression));
@@ -371,8 +413,10 @@ public RecordedMethodCallResult SetCurrentDirectory(
public RecordedMethodCallResult SetLastAccessTime(
Func? path = null,
Func? lastAccessTime = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(lastAccessTime))] string? lastAccessTimeExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(lastAccessTime))]
+ string? lastAccessTimeExpression = null)
=> Build(nameof(IDirectory.SetLastAccessTime),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("lastAccessTime", lastAccessTime, lastAccessTimeExpression));
@@ -381,8 +425,10 @@ public RecordedMethodCallResult SetLastAccessTime(
public RecordedMethodCallResult SetLastAccessTimeUtc(
Func? path = null,
Func? lastAccessTimeUtc = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(lastAccessTimeUtc))] string? lastAccessTimeUtcExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(lastAccessTimeUtc))]
+ string? lastAccessTimeUtcExpression = null)
=> Build(nameof(IDirectory.SetLastAccessTimeUtc),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("lastAccessTimeUtc", lastAccessTimeUtc, lastAccessTimeUtcExpression));
@@ -391,8 +437,10 @@ public RecordedMethodCallResult SetLastAccessTimeUtc(
public RecordedMethodCallResult SetLastWriteTime(
Func? path = null,
Func? lastWriteTime = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(lastWriteTime))] string? lastWriteTimeExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(lastWriteTime))]
+ string? lastWriteTimeExpression = null)
=> Build(nameof(IDirectory.SetLastWriteTime),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("lastWriteTime", lastWriteTime, lastWriteTimeExpression));
@@ -401,8 +449,10 @@ public RecordedMethodCallResult SetLastWriteTime(
public RecordedMethodCallResult SetLastWriteTimeUtc(
Func? path = null,
Func? lastWriteTimeUtc = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(lastWriteTimeUtc))] string? lastWriteTimeUtcExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(lastWriteTimeUtc))]
+ string? lastWriteTimeUtcExpression = null)
=> Build(nameof(IDirectory.SetLastWriteTimeUtc),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("lastWriteTimeUtc", lastWriteTimeUtc, lastWriteTimeUtcExpression));
@@ -414,7 +464,7 @@ private static ParameterMatcher SearchOrEnumerationMatcher(
, Func? enumerationOptions,
string? enumerationOptionsExpression
#endif
- )
+ )
{
#if NET6_0_OR_GREATER
if (enumerationOptions is not null)
diff --git a/Source/aweXpect.Testably/Recorded/RecordedDriveInfoBucket.cs b/Source/aweXpect.Testably/Recorded/RecordedDriveInfoBucket.cs
index 9d6edf6..37249c8 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedDriveInfoBucket.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedDriveInfoBucket.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.IO.Abstractions;
using System.Runtime.CompilerServices;
using aweXpect.Core;
@@ -41,7 +42,8 @@ public RecordedMethodCallResult GetDrives()
///
public RecordedMethodCallResult New(
Func? driveName = null,
- [CallerArgumentExpression(nameof(driveName))] string? driveNameExpression = null)
+ [CallerArgumentExpression(nameof(driveName))]
+ string? driveNameExpression = null)
=> Build(nameof(IDriveInfoFactory.New),
ParameterMatcher.From("driveName", driveName, driveNameExpression));
@@ -49,8 +51,9 @@ public RecordedMethodCallResult New(
/// Recorded calls to .
///
public RecordedMethodCallResult Wrap(
- Func? driveInfo = null,
- [CallerArgumentExpression(nameof(driveInfo))] string? driveInfoExpression = null)
+ Func? driveInfo = null,
+ [CallerArgumentExpression(nameof(driveInfo))]
+ string? driveInfoExpression = null)
=> Build(nameof(IDriveInfoFactory.Wrap),
ParameterMatcher.From("driveInfo", driveInfo, driveInfoExpression));
diff --git a/Source/aweXpect.Testably/Recorded/RecordedDriveInfoInstance.cs b/Source/aweXpect.Testably/Recorded/RecordedDriveInfoInstance.cs
index af8b92a..aefa77d 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedDriveInfoInstance.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedDriveInfoInstance.cs
@@ -10,9 +10,9 @@ namespace aweXpect.Testably.Recorded;
///
public sealed class RecordedDriveInfoInstance
{
- private readonly IThat _subject;
- private readonly string _driveName;
private readonly string _bucketDescription;
+ private readonly string _driveName;
+ private readonly IThat _subject;
internal RecordedDriveInfoInstance(IThat subject, string driveName)
{
diff --git a/Source/aweXpect.Testably/Recorded/RecordedFileInfoBucket.cs b/Source/aweXpect.Testably/Recorded/RecordedFileInfoBucket.cs
index 67cf795..ca64a40 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedFileInfoBucket.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedFileInfoBucket.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.IO.Abstractions;
using System.Runtime.CompilerServices;
using aweXpect.Core;
@@ -35,7 +36,8 @@ public RecordedFileInfoInstance this[string path]
///
public RecordedMethodCallResult New(
Func? fileName = null,
- [CallerArgumentExpression(nameof(fileName))] string? fileNameExpression = null)
+ [CallerArgumentExpression(nameof(fileName))]
+ string? fileNameExpression = null)
=> Build(nameof(IFileInfoFactory.New),
ParameterMatcher.From("fileName", fileName, fileNameExpression));
@@ -43,8 +45,9 @@ public RecordedMethodCallResult New(
/// Recorded calls to .
///
public RecordedMethodCallResult Wrap(
- Func? fileInfo = null,
- [CallerArgumentExpression(nameof(fileInfo))] string? fileInfoExpression = null)
+ Func? fileInfo = null,
+ [CallerArgumentExpression(nameof(fileInfo))]
+ string? fileInfoExpression = null)
=> Build(nameof(IFileInfoFactory.Wrap),
ParameterMatcher.From("fileInfo", fileInfo, fileInfoExpression));
diff --git a/Source/aweXpect.Testably/Recorded/RecordedFileInfoInstance.cs b/Source/aweXpect.Testably/Recorded/RecordedFileInfoInstance.cs
index a6509b5..e924094 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedFileInfoInstance.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedFileInfoInstance.cs
@@ -15,9 +15,9 @@ namespace aweXpect.Testably.Recorded;
///
public sealed class RecordedFileInfoInstance
{
- private readonly IThat _subject;
- private readonly string _path;
private readonly string _bucketDescription;
+ private readonly string _path;
+ private readonly IThat _subject;
internal RecordedFileInfoInstance(IThat subject, string path)
{
@@ -26,6 +26,116 @@ internal RecordedFileInfoInstance(IThat subject, string p
_bucketDescription = $"FileInfo[\"{path}\"]";
}
+ ///
+ /// Recorded accesses to via .
+ ///
+ public RecordedProperty Attributes
+ => Property(nameof(IFileSystemInfo.Attributes));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty CreationTime
+ => Property(nameof(IFileSystemInfo.CreationTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty CreationTimeUtc
+ => Property(nameof(IFileSystemInfo.CreationTimeUtc));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Directory
+ => Property(nameof(IFileInfo.Directory));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty DirectoryName
+ => Property(nameof(IFileInfo.DirectoryName));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Exists
+ => Property(nameof(IFileSystemInfo.Exists));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Extension
+ => Property(nameof(IFileSystemInfo.Extension));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty FullName
+ => Property(nameof(IFileSystemInfo.FullName));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty IsReadOnly
+ => Property(nameof(IFileInfo.IsReadOnly));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastAccessTime
+ => Property(nameof(IFileSystemInfo.LastAccessTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastAccessTimeUtc
+ => Property(nameof(IFileSystemInfo.LastAccessTimeUtc));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastWriteTime
+ => Property(nameof(IFileSystemInfo.LastWriteTime));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty LastWriteTimeUtc
+ => Property(nameof(IFileSystemInfo.LastWriteTimeUtc));
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Length
+ => Property(nameof(IFileInfo.Length));
+
+ ///
+ /// Recorded accesses to IFileSystemInfo.LinkTarget.
+ ///
+ public RecordedProperty LinkTarget
+#if NET6_0_OR_GREATER
+ => Property(nameof(IFileSystemInfo.LinkTarget));
+#else
+ => Property("LinkTarget");
+#endif
+
+ ///
+ /// Recorded accesses to .
+ ///
+ public RecordedProperty Name
+ => Property(nameof(IFileSystemInfo.Name));
+
+ ///
+ /// Recorded accesses to IFileSystemInfo.UnixFileMode.
+ ///
+ public RecordedProperty UnixFileMode
+#if NET7_0_OR_GREATER
+ => Property(nameof(IFileSystemInfo.UnixFileMode));
+#else
+ => Property("UnixFileMode");
+#endif
+
///
/// Recorded calls to .
///
@@ -38,8 +148,10 @@ public RecordedMethodCallResult AppendText()
public RecordedMethodCallResult CopyTo(
Func? destFileName = null,
Func? overwrite = null,
- [CallerArgumentExpression(nameof(destFileName))] string? destFileNameExpression = null,
- [CallerArgumentExpression(nameof(overwrite))] string? overwriteExpression = null)
+ [CallerArgumentExpression(nameof(destFileName))]
+ string? destFileNameExpression = null,
+ [CallerArgumentExpression(nameof(overwrite))]
+ string? overwriteExpression = null)
=> Build(nameof(IFileInfo.CopyTo),
ParameterMatcher.From("destFileName", destFileName, destFileNameExpression),
ParameterMatcher.From("overwrite", overwrite, overwriteExpression));
@@ -55,7 +167,8 @@ public RecordedMethodCallResult Create()
///
public RecordedMethodCallResult CreateAsSymbolicLink(
Func? pathToTarget = null,
- [CallerArgumentExpression(nameof(pathToTarget))] string? pathToTargetExpression = null)
+ [CallerArgumentExpression(nameof(pathToTarget))]
+ string? pathToTargetExpression = null)
=> Build("CreateAsSymbolicLink",
ParameterMatcher.From("pathToTarget", pathToTarget, pathToTargetExpression));
@@ -89,8 +202,10 @@ public RecordedMethodCallResult Encrypt()
public RecordedMethodCallResult MoveTo(
Func? destFileName = null,
Func? overwrite = null,
- [CallerArgumentExpression(nameof(destFileName))] string? destFileNameExpression = null,
- [CallerArgumentExpression(nameof(overwrite))] string? overwriteExpression = null)
+ [CallerArgumentExpression(nameof(destFileName))]
+ string? destFileNameExpression = null,
+ [CallerArgumentExpression(nameof(overwrite))]
+ string? overwriteExpression = null)
=> Build(nameof(IFileInfo.MoveTo),
ParameterMatcher.From("destFileName", destFileName, destFileNameExpression),
ParameterMatcher.From("overwrite", overwrite, overwriteExpression));
@@ -108,9 +223,12 @@ public RecordedMethodCallResult Open(
Func? mode = null,
Func? access = null,
Func? share = null,
- [CallerArgumentExpression(nameof(mode))] string? modeExpression = null,
- [CallerArgumentExpression(nameof(access))] string? accessExpression = null,
- [CallerArgumentExpression(nameof(share))] string? shareExpression = null)
+ [CallerArgumentExpression(nameof(mode))]
+ string? modeExpression = null,
+ [CallerArgumentExpression(nameof(access))]
+ string? accessExpression = null,
+ [CallerArgumentExpression(nameof(share))]
+ string? shareExpression = null)
=> Build(nameof(IFileInfo.Open),
ParameterMatcher.From("mode", mode, modeExpression),
ParameterMatcher.From("access", access, accessExpression),
@@ -147,9 +265,12 @@ public RecordedMethodCallResult Replace(
Func? destinationFileName = null,
Func? destinationBackupFileName = null,
Func? ignoreMetadataErrors = null,
- [CallerArgumentExpression(nameof(destinationFileName))] string? destinationFileNameExpression = null,
- [CallerArgumentExpression(nameof(destinationBackupFileName))] string? destinationBackupFileNameExpression = null,
- [CallerArgumentExpression(nameof(ignoreMetadataErrors))] string? ignoreMetadataErrorsExpression = null)
+ [CallerArgumentExpression(nameof(destinationFileName))]
+ string? destinationFileNameExpression = null,
+ [CallerArgumentExpression(nameof(destinationBackupFileName))]
+ string? destinationBackupFileNameExpression = null,
+ [CallerArgumentExpression(nameof(ignoreMetadataErrors))]
+ string? ignoreMetadataErrorsExpression = null)
=> Build(nameof(IFileInfo.Replace),
ParameterMatcher.From("destinationFileName", destinationFileName, destinationFileNameExpression),
ParameterMatcher.From("destinationBackupFileName", destinationBackupFileName, destinationBackupFileNameExpression),
@@ -160,120 +281,11 @@ public RecordedMethodCallResult Replace(
///
public RecordedMethodCallResult ResolveLinkTarget(
Func? returnFinalTarget = null,
- [CallerArgumentExpression(nameof(returnFinalTarget))] string? returnFinalTargetExpression = null)
+ [CallerArgumentExpression(nameof(returnFinalTarget))]
+ string? returnFinalTargetExpression = null)
=> Build("ResolveLinkTarget",
ParameterMatcher.From("returnFinalTarget", returnFinalTarget, returnFinalTargetExpression));
- ///
- /// Recorded accesses to via .
- ///
- public RecordedProperty Attributes
- => Property(nameof(IFileSystemInfo.Attributes));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty CreationTime
- => Property(nameof(IFileSystemInfo.CreationTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty CreationTimeUtc
- => Property(nameof(IFileSystemInfo.CreationTimeUtc));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Directory
- => Property(nameof(IFileInfo.Directory));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty DirectoryName
- => Property(nameof(IFileInfo.DirectoryName));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Exists
- => Property(nameof(IFileSystemInfo.Exists));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Extension
- => Property(nameof(IFileSystemInfo.Extension));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty FullName
- => Property(nameof(IFileSystemInfo.FullName));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty IsReadOnly
- => Property(nameof(IFileInfo.IsReadOnly));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastAccessTime
- => Property(nameof(IFileSystemInfo.LastAccessTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastAccessTimeUtc
- => Property(nameof(IFileSystemInfo.LastAccessTimeUtc));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastWriteTime
- => Property(nameof(IFileSystemInfo.LastWriteTime));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty LastWriteTimeUtc
- => Property(nameof(IFileSystemInfo.LastWriteTimeUtc));
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Length
- => Property(nameof(IFileInfo.Length));
-
- ///
- /// Recorded accesses to IFileSystemInfo.LinkTarget.
- ///
- public RecordedProperty LinkTarget
-#if NET6_0_OR_GREATER
- => Property(nameof(IFileSystemInfo.LinkTarget));
-#else
- => Property("LinkTarget");
-#endif
-
- ///
- /// Recorded accesses to .
- ///
- public RecordedProperty Name
- => Property(nameof(IFileSystemInfo.Name));
-
- ///
- /// Recorded accesses to IFileSystemInfo.UnixFileMode.
- ///
- public RecordedProperty UnixFileMode
-#if NET7_0_OR_GREATER
- => Property(nameof(IFileSystemInfo.UnixFileMode));
-#else
- => Property("UnixFileMode");
-#endif
-
private RecordedProperty Property(string propertyName)
{
string path = _path;
diff --git a/Source/aweXpect.Testably/Recorded/RecordedFileMethods.cs b/Source/aweXpect.Testably/Recorded/RecordedFileMethods.cs
index d2f73d6..9bdbd31 100644
--- a/Source/aweXpect.Testably/Recorded/RecordedFileMethods.cs
+++ b/Source/aweXpect.Testably/Recorded/RecordedFileMethods.cs
@@ -37,8 +37,10 @@ internal RecordedFileMethods(IThat subject)
public RecordedMethodCallResult AppendAllBytes(
Func? path = null,
Func? bytes = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(bytes))] string? bytesExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(bytes))]
+ string? bytesExpression = null)
=> Build("AppendAllBytes",
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("bytes", bytes, bytesExpression));
@@ -51,8 +53,10 @@ public RecordedMethodCallResult AppendAllBytes(
public RecordedMethodCallResult AppendAllBytesAsync(
Func? path = null,
Func? bytes = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(bytes))] string? bytesExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(bytes))]
+ string? bytesExpression = null)
=> Build("AppendAllBytesAsync",
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From("bytes", bytes, bytesExpression));
@@ -61,8 +65,10 @@ public RecordedMethodCallResult AppendAllBytesAsync(
public RecordedMethodCallResult AppendAllLines(
Func? path = null,
Func? encoding = null,
- [CallerArgumentExpression(nameof(path))] string? pathExpression = null,
- [CallerArgumentExpression(nameof(encoding))] string? encodingExpression = null)
+ [CallerArgumentExpression(nameof(path))]
+ string? pathExpression = null,
+ [CallerArgumentExpression(nameof(encoding))]
+ string? encodingExpression = null)
=> Build(nameof(IFile.AppendAllLines),
ParameterMatcher.From("path", path, pathExpression),
ParameterMatcher.From