public void CreateEntityWithValidInput() { // ARRANGE DTOModelA modelA = new DTOModelA { Id = 0, Name = "Pippo", Surname = "Poppi" }; DTOModelA result = new DTOModelA(); IEntityA mockEntityA = Substitute.For <EntityAMock>(); IRepositoryA mockRepositoryA = Substitute.For <RepositoryAMock>(); mockRepositoryA.CreateEntity(mockEntityA); IDataStore mockDataStore = Substitute.For <DataStoreMock>(); IDataSupplier mockDataSupplier = Substitute.For <DataSupplierMock>(); ICoreStore mockCoreStore = Substitute.For <CoreStoreMock>(); // ACT ICoreSupplier testCoreSupplier = CoreSupplier.Instance(mockCoreStore); testCoreSupplier.GetFeatureA.CreatePost(modelA); result = testCoreSupplier.GetFeatureA.DetailsGet(modelA); // ASSERT Assert.IsInstanceOf <DTOModelA>(result); Assert.AreEqual(modelA.Id, result.Id); }
public static IRepositoryA Instance(string connectionString, IProjectDbContext projectDbContext) { if (RepositoryAInstance == null) { RepositoryAInstance = new RepositoryA(connectionString, projectDbContext); } return(RepositoryAInstance); }
public static IRepositoryA Instance(string connectionString) { if (RepositoryAInstance == null) { RepositoryAInstance = new RepositoryA(connectionString); } return(RepositoryAInstance); }
public static IRepositoryA Instance(IProjectDbContext projectDbContext) { if (RepositoryAInstance == null) { RepositoryAInstance = new RepositoryA(projectDbContext); } return(RepositoryAInstance); }
public static IRepositoryA Instance() { if (RepositoryAInstance == null) { RepositoryAInstance = new RepositoryA(); } return(RepositoryAInstance); }
public static IDataStore Instance(IRepositoryA repositoryA, IRepositoryB repositoryB) { if (DataStoreInstance == null) { DataStoreInstance = new DataStore(repositoryA, repositoryB); } return(DataStoreInstance); }
public AppServiceTest(IRepositoryA repoA, IRepositoryB repoB) { if (repoA == null) { throw new ArgumentNullException("repoA"); } if (repoB == null) { throw new ArgumentNullException("repoA"); } _repoA = repoA; _repoB = repoB; }
public Processor(IRepositoryA repositoryA) { _repositoryA = repositoryA; }
// Pass Mock Repositories in unit tests -> PS: You can't have 2 constructors if you're using dependency injection. public Service(RepositoryA a, RepositoryB b) { _a = a; _b = b; }
protected DataStore(IRepositoryA repositoryA, IRepositoryB repositoryB) { DataRepositoryA = repositoryA; DataRepositoryB = repositoryB; }
protected DataStore(IRepositoryA repositoryA) { DataRepositoryA = repositoryA; }