コード例 #1
0
        public void GetAll_Returns_All_When_Set_To_Do_So()
        {
            //Arrange.
            List <Family> items = new List <Family>()
            {
                new Family {
                    Id = 1, IsActive = true, Name = "Wilks"
                },
                new Family {
                    Id = 2, IsActive = false, Name = "Novacs"
                },
                new Family {
                    Id = 3, IsActive = true, Name = "Kovalcyk"
                }
            };

            var mockRepo = new Mock <IFamilyRepository>();

            mockRepo.Setup(c => c.GetAll()).Returns(items.AsQueryable());

            var sevice = new FamilyService(mockRepo.Object);

            //Act.
            var result = sevice.GetAll(false);

            //Assert.
            Assert.AreEqual(result.Count(), items.Count);
        }