CCG.CQRS.Tests
1.0.7
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CCG.CQRS.Tests --version 1.0.7
NuGet\Install-Package CCG.CQRS.Tests -Version 1.0.7
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="CCG.CQRS.Tests" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CCG.CQRS.Tests --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CCG.CQRS.Tests, 1.0.7"
#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 CCG.CQRS.Tests as a Cake Addin
#addin nuget:?package=CCG.CQRS.Tests&version=1.0.7
// Install CCG.CQRS.Tests as a Cake Tool
#tool nuget:?package=CCG.CQRS.Tests&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Usage
The new Mock<PipDbContext>().WithDbSets()
extension method setups Mock<DbSet>()
for all the DbSets on the DbContext.
Support methods are:
- DbContext
Set<T>
- DbSet properties
- DbSet
Add(T model)
Remove(T model)
AddRange(IEnumerable<T> list)
RemoveRange(IEnumerable<T> list)
Find()
for CCG.CQRS.DataModel.IEntityInclude(string)
To get access to a fixture you can use the MockContextHelpers.CreateFixture()
static method.
Examples
private Mock<PipDbContext> _db;
private AddEmployeeCommandValidator _validator;
private AddEmployeeHandler _handler;
[TestInitialize]
public void Setup()
{
// mock entity framework db context.
// WithDbSets() will create mock dbsets for all DbSets on context
_db = new Mock<PipDbContext>().WithMockDbSets();
// extension method CreateEntities(n) will create n fake entities with autofixture
Mock.Get(_db.Object.PhoneNumberTypes).CreateEntities(3);
_validator = new AddEmployeeCommandValidator(_db.Object);
_handler = new AddEmployeeHandler(_db.Object);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5
- AutoFixture (>= 3.51.0)
- CCG.CQRS (>= 1.0.7)
- EntityFramework (>= 6.2.0)
- Moq (>= 4.8.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.