Example #1
0
        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();
        }