public void test_part_repository_usage() { PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass(); IEnumerable <Part> partItems = repositoryTest.GetAllPart(); Assert.IsNotNull(partItems); }
public void test_part_repository_usage() { PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass(); IEnumerable<Part> partItems = repositoryTest.GetAllPart(); Assert.IsNotNull(partItems); }
public void test_part_repository_mocking() { List<Part> parts = new List<Part>() { new Part() { Id = 1, Notes = "Part One" }, new Part() { Id = 2, Notes = "Part Two" } }; Mock<IPartRepository> mockPartRepository = new Mock<IPartRepository>(); mockPartRepository.Setup(obj => obj.Get()).Returns(parts); PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass(mockPartRepository.Object); IEnumerable<Part> ret = repositoryTest.GetAllPart(); Assert.AreEqual(ret, parts); }
public void test_part_repository_mocking() { List <Part> parts = new List <Part>() { new Part() { Id = 1, Notes = "Part One" }, new Part() { Id = 2, Notes = "Part Two" } }; Mock <IPartRepository> mockPartRepository = new Mock <IPartRepository>(); mockPartRepository.Setup(obj => obj.Get()).Returns(parts); PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass(mockPartRepository.Object); IEnumerable <Part> ret = repositoryTest.GetAllPart(); Assert.AreEqual(ret, parts); }