コード例 #1
0
        public void test_part_repository_usage()
        {
            PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass();

            IEnumerable <Part> partItems = repositoryTest.GetAllPart();

            Assert.IsNotNull(partItems);
        }
コード例 #2
0
        public void test_part_repository_usage()
        {
            PartRepositoryTestClass repositoryTest = new PartRepositoryTestClass();

            IEnumerable<Part> partItems = repositoryTest.GetAllPart();

            Assert.IsNotNull(partItems);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }