public FamiliesControllerTests()
        {
            var list = new List <Family>
            {
                new Family {
                    Id = 1, Name = "test 1", BusinessId = 2
                },
                new Family {
                    Id = 2, Name = "test 2", BusinessId = 1
                }
            }.AsQueryable();

            var mockContext        = Substitute.For <TtContext>();
            var familyRepository   = Substitute.For <Repository <Family> >(mockContext);
            var businessRepository = Substitute.For <Repository <Business> >(mockContext);

            _service = Substitute.For <FamilyService>(familyRepository, businessRepository);
            _service.GetList().Returns(list);
            _service.GetItem(Arg.Any <int>()).Returns(new Family {
                Id = 1, Name = "test 1", BusinessId = 1
            });
            _service.Create(Arg.Any <Family>());
            _service.Update(Arg.Any <int>(), Arg.Any <Family>());
            _service.Delete(Arg.Any <int>());

            var mockLogger = Substitute.For <ILoggerFactory>();

            _controller = new FamiliesController(_service, mockLogger);
        }
Ejemplo n.º 2
0
 public void GetListTest()
 {
     Assert.Equal(3, _service.GetList().Count());
 }