public OfferingsControllerTests()
        {
            var list = new List <Offering>
            {
                new Offering {
                    Id = 1, Name = "test 1", FamilyId = 2
                },
                new Offering {
                    Id = 2, Name = "test 2", FamilyId = 1
                }
            }.AsQueryable();

            var mockContext        = Substitute.For <TtContext>();
            var offeringRepository = Substitute.For <Repository <Offering> >(mockContext);
            var familyRepository   = Substitute.For <Repository <Family> >(mockContext);

            _service = Substitute.For <OfferingService>(offeringRepository, familyRepository);
            _service.GetList().Returns(list);
            _service.GetItem(Arg.Any <int>()).Returns(new Offering {
                Id = 1, Name = "test 1", FamilyId = 1
            });
            _service.Create(Arg.Any <Offering>());
            _service.Update(Arg.Any <int>(), Arg.Any <Offering>());
            _service.Delete(Arg.Any <int>());

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

            _controller = new OfferingsController(_service, mockLogger);
        }
Ejemplo n.º 2
0
 public OfferingsControllerTest(GlobalFixture fixture) : base(fixture)
 {
     _controller = new OfferingsController(
         fixture._authorizationService,
         _context,
         _userUtils,
         null
         )
     {
         ControllerContext = fixture._controllerContext
     };
 }