public void Find_ProductionReadyCode_From_Repository_ById_Test(List <ProductionReadyCode> allCodes, ProductionReadyCode searchedResult, int id) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); //Setup var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); //Act var results = prodRepository.FindById(id); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); // var results = fakeDbContext.ProductionReadyCodes; //Assert results.Should().BeEquivalentTo(searchedResult); results.Should().NotBeNull(); }
public void Save_ProductionReadyCode_To_Repository_Test(List <ProductionReadyCode> allCodes, ProductionReadyCode saveData) { var fakeDbContext = A.Fake <IMetaDataContext <ProductionReadyCode> >(ops => ops.Strict()); //Setup var prodRepository = new ProductionRepository <ProductionReadyCode>(fakeDbContext); A.CallTo(() => fakeDbContext.ProductionReadyCodes).Returns(allCodes); //Act prodRepository.Save(saveData); A.CallTo(() => fakeDbContext.ProductionReadyCodes).MustHaveHappened(); var results = fakeDbContext.ProductionReadyCodes; //Assert results.Should().Contain(x => Equals(x.Id, saveData.Id)); results.Should().HaveCount(allCodes.Count); }