public ServiceControllerTests(TestFixture <Startup> fixture)
        {
            SubjectRepository = SubjectMockRepository.GetRepository();

            var imapper = (IMapper)fixture.Server.Host.Services.GetService(typeof(IMapper));
            var ilogger =
                (ILogger <SubjectController>)fixture.Server.Host.Services.GetService(typeof(ILogger <SubjectController>));
            var srv = new SubjectService(SubjectRepository.Object);

            //SERVICES CONFIGURATIONS
            _sut = new SubjectController(imapper, ilogger, srv)
            {
                ControllerContext = new ControllerContext {
                    HttpContext = new DefaultHttpContext()
                }
            };
            _sut.ControllerContext.HttpContext.Request.Scheme = "http";
            _sut.ControllerContext.HttpContext.Request.Host   = new HostString("fakehost", 4000);
        }
Example #2
0
 public SubjectServicesTests()
 {
     SubjectRepository = SubjectMockRepository.GetRepository();
     _sut = new SubjectService(SubjectRepository.Object);
 }