public async Task ShouldGetMainEvent() { UserStore <ApplicationUser> store = new UserStore <ApplicationUser>(_dbContext); UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(store, null, new PasswordHasher <ApplicationUser>(), null, null, null, null, null, null); MainEventService mainEventService = new MainEventService(_dbContext, userManager); SecurityService securityService = new SecurityService(_dbContext, userManager, _roleManager); MainEventController mainEventController = new MainEventController(mainEventService, securityService); CreateUser(); SetUser(mainEventController, _createdUser.Entity.Id); CreateMainEvents(); await mainEventController.SetCurrentEventAsync(2); ActionResult <CurrentMainEventVm> result = await mainEventController.GetCurrentMainEventAsync(); Assert.AreEqual(_eventName2, result.Value.Name); }
public async Task ShouldSetMainEvent() { UserStore <ApplicationUser> store = new UserStore <ApplicationUser>(_dbContext); UserManager <ApplicationUser> userManager = new UserManager <ApplicationUser>(store, null, new PasswordHasher <ApplicationUser>(), null, null, null, null, null, null); MainEventService mainEventService = new MainEventService(_dbContext, userManager); SecurityService securityService = new SecurityService(_dbContext, userManager, _roleManager); MainEventController mainEventController = new MainEventController(mainEventService, securityService); CreateUser(); SetUser(mainEventController, _createdUser.Entity.Id); CreateMainEvents(); await mainEventController.SetCurrentEventAsync(2); ApplicationUser usr = _dbContext.Users.Find(_createdUser.Entity.Id); Assert.AreEqual(usr.CurrentMainEventId, _createdUser.Entity.CurrentMainEventId); }