AutoFixtureSetup.NSubstitute
4.17.1-g15935cbe85
This is a prerelease version of AutoFixtureSetup.NSubstitute.
dotnet add package AutoFixtureSetup.NSubstitute --version 4.17.1-g15935cbe85
NuGet\Install-Package AutoFixtureSetup.NSubstitute -Version 4.17.1-g15935cbe85
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AutoFixtureSetup.NSubstitute" Version="4.17.1-g15935cbe85" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AutoFixtureSetup.NSubstitute --version 4.17.1-g15935cbe85
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AutoFixtureSetup.NSubstitute, 4.17.1-g15935cbe85"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AutoFixtureSetup.NSubstitute as a Cake Addin
#addin nuget:?package=AutoFixtureSetup.NSubstitute&version=4.17.1-g15935cbe85&prerelease
// Install AutoFixtureSetup.NSubstitute as a Cake Tool
#tool nuget:?package=AutoFixtureSetup.NSubstitute&version=4.17.1-g15935cbe85&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AutoFixtureSetup
Extending AutoFixture to automatically setup and optionally mock all calls on interfaces, abstract and concrete types.
- Uses IFixtureSetup and BaseFixtureSetup extensibility point that allows users to setup mock fixtures based on fixed values if intended so.
- Provide options to setup a type either with its actual implementation instance or as a mock type.
- Implementations of IFixtureSetup will use recursive mocks by default to provide values whenever possible. Default recursion depth is 1.
- Implementations of IFixtureSetup will freeze it's instance (as singleton) onto the fixture container. This is done so that any other dependent fixture objects will refer to the same instance.
- All properties and methods can be setup with the usual mocking framework's setup method.
- Provide random values for Nullable types by referring to its base type by default; else you can also pass in
null
value if desired so via normal assignments.- Nullable types are not supported by AutoFixture by default.
- Resolve all fixture dependencies by retrieving an existing object instance from the fixture container. This is possible with the use of
Fixture.Inject
andFixture.Freeze
.If you need to replace the instance of the object generated from the fixture container, you will need to manually do re-assignment after initializing the
FixtureSetup
.var fixtureSetup = new ComplexChildFixture(fixture); var i1 = fixtureSetup.Valid; // Replace the auto-generated instance from fixture container i1.SimpleChild = new SimpleChild("newSimpleChild"); // Execute operation // Assert i1.SimpleChild.Name.Should().Be("newSimpleChild");
Supported Mocking Frameworks
Framework | Version |
---|---|
AutoFixtureSetup.NSubstitute | 4.17.1 |
AutoFixtureSetup.Moq | 4.17.1 |
TO DO
- Allow mock types should respect ComposerTransformation.
- Add options to allow users to determine the object lifetime (currently Singleton) of the IFixtureSetup object. The same goes to the Inject() method.
- This would allow user to AutoFixture to randomly generate values for each instances without needing user to manually do re-assignment.
- Add options to turn off recursive mocks.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- AutoFixture.AutoNSubstitute (>= 4.17.0)
- AutoFixture.Xunit2 (>= 4.17.0)
- NSubstitute (>= 4.3.0)
-
.NETStandard 2.1
- AutoFixture.AutoNSubstitute (>= 4.17.0)
- AutoFixture.Xunit2 (>= 4.17.0)
- NSubstitute (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.17.1-g15935cbe85 | 182 | 3/23/2022 |
4.17.0 | 2,444 | 3/21/2022 |