Esempio n. 1
0
        public DepartmentsApiControllerTests()
        {
            _mockDepartmentRepo = Departments.AsMockRepository <Department>();
            var mockUnitOfWork = new Mock <UnitOfWork <ApiContext> >();

            mockUnitOfWork.Setup(c => c.DepartmentRepository).Returns(_mockDepartmentRepo.Object);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <ApiProfile>();
            });

            _mapper = config.CreateMapper();
            _sut    = new DepartmentsController(mockUnitOfWork.Object, _mapper);
        }
        public DepartmentsControllerTests(ITestOutputHelper output)
        {
            this.output                   = output;
            mockDepartmentRepo            = Departments.AsMockRepository();
            mockInstructorRepo            = Instructors.AsMockPersonRepository();
            mockModelBindingHelperAdaptor = new Mock <IModelBindingHelperAdaptor>();
            var config = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <WebProfile>();
            });

            _mapper = config.CreateMapper();


            var mockUnitOfWork = new Mock <UnitOfWork <ApplicationContext> >();

            mockUnitOfWork.Setup(c => c.DepartmentRepository).Returns(mockDepartmentRepo.Object);
            mockUnitOfWork.Setup(c => c.InstructorRepository).Returns(mockInstructorRepo.Object);

            sut = new DepartmentsController(mockUnitOfWork.Object, mockModelBindingHelperAdaptor.Object, _mapper);
        }