public KudosController(IMapper mapper, IKudosService kudosService, IKudosExportService kudosExportService, IPermissionService permissionService) { _mapper = mapper; _kudosService = kudosService; _kudosExportService = kudosExportService; _permissionService = permissionService; }
public void TestInitializer() { _mapper = Substitute.For <IMapper>(); _kudosService = Substitute.For <IKudosService>(); _kudosExportService = Substitute.For <IKudosExportService>(); _permissionService = Substitute.For <IPermissionService>(); _kudosController = new KudosController(_mapper, _kudosService, _kudosExportService, _permissionService); _kudosController.ControllerContext = Substitute.For <HttpControllerContext>(); _kudosController.Request = new HttpRequestMessage(); _kudosController.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); _kudosController.Request.SetConfiguration(new HttpConfiguration()); _kudosController.RequestContext.Principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, "1"), new Claim("OrganizationId", "1") })); }
public void TestInitializer() { _uow = Substitute.For <IUnitOfWork2>(); _kudosDbSet = Substitute.For <DbSet <KudosLog>, IQueryable <KudosLog>, IDbAsyncEnumerable <KudosLog> >(); _kudosDbSet.SetDbSetDataForAsync(MockKudos()); _uow.GetDbSet <KudosLog>().Returns(_kudosDbSet); _usersDbSet = Substitute.For <DbSet <ApplicationUser>, IQueryable <ApplicationUser>, IDbAsyncEnumerable <ApplicationUser> >(); _usersDbSet.SetDbSetDataForAsync(MockUsers()); _uow.GetDbSet <ApplicationUser>().Returns(_usersDbSet); _excelBuilder = new ExcelBuilder(); _kudosExportService = new KudosExportService( _uow, _excelBuilder); }