public void TestInitialize()
        {
            _waServ  = new Mock <IWorkAssignmentService>();
            _wkrServ = new Mock <IWorkerService>();
            _woServ  = new Mock <IWorkOrderService>();
            _wsiServ = new Mock <IWorkerSigninService>();
            _def     = new Mock <IDefaults>();
            var mapperConfig = new MapperConfiguration(config => { config.ConfigureMvc(); });

            _map = mapperConfig.CreateMapper();

            _adaptor = new Mock <IModelBindingAdaptor>();
            _adaptor.Setup(dependency =>
                           dependency.TryUpdateModelAsync(It.IsAny <MacheteController>(), It.IsAny <object>()))
            .Returns(Task.FromResult(true));

            _tenantService = new Mock <ITenantService>();
            _tenantService.Setup(service => service.GetCurrentTenant()).Returns(_tenant);
            _tenantService.Setup(service => service.GetAllTenants()).Returns(new List <Tenant> {
                _tenant
            });

            _controller = new WorkAssignmentController(_waServ.Object, _woServ.Object, _wsiServ.Object, _def.Object,
                                                       _map, _adaptor.Object, _tenantService.Object);

            _fakeId = 12345;
        }
Ejemplo n.º 2
0
 public void TestInitialize()
 {
     waServ    = new Mock <IWorkAssignmentService>();
     wkrServ   = new Mock <IWorkerService>();
     woServ    = new Mock <IWorkOrderService>();
     wsiServ   = new Mock <IWorkerSigninService>();
     def       = new Mock <IDefaults>();
     map       = new Mock <IMapper>();
     dbfactory = new Mock <IDatabaseFactory>();
     _ctrlr    = new WorkAssignmentController(waServ.Object, woServ.Object, wsiServ.Object, def.Object, map.Object);
     _view     = new WorkAssignmentIndex();
     _ctrlr.SetFakeControllerContext();
     fakeform = new FormCollection();
     fakeform.Add("ID", "12345");
 }