public async Task GetPageForNewUserTest() { //Arrange var vmUser = new VmUser { LastName = "New", FirstName = "New", Email = "New@New", UserName = "******" }; var vmNewUser = await _usersService.Create(vmUser, "new12345!"); var newUser = new VmUserConverter().ToModel(vmNewUser); var pageOptions = new PageOptions { PageNumber = 0, PageSize = 10, }; //Act var goals = (await _service.GetPage(newUser, null, pageOptions)).ToArray(); //Assert Assert.AreEqual(0, goals.Length); }
/// <summary> /// /// </summary> /// <param name="dataContext"></param> /// <param name="userManager"></param> /// <param name="entityStateQueue"></param> public UsersService(DataContext dataContext, UserManager <ApplicationUser> userManager, IBackgroundTaskQueue <VmEntityStateMessage> entityStateQueue) { _dataContext = dataContext; _userManager = userManager; _entityStateQueue = entityStateQueue; _vmConverter = new VmUserConverter(); }
public void Setup() { var serviceProvider = _testContext.Initialize(out _testData); _dataContext = serviceProvider.GetRequiredService <DataContext>(); _userManager = serviceProvider.GetRequiredService <UserManager <ApplicationUser> >(); _service = serviceProvider.GetRequiredService <IUsersService>(); _vmConverter = new VmUserConverter(); _currentUser = _testData.Users.First(); }
public void Setup() { _dbConnection = ContextHelper.OpenSqliteInMemoryConnection(); using var dataContext = ContextHelper.CreateContext(_dbConnection, false); dataContext.Database.EnsureCreated(); var configMock = new Mock <IConfiguration>(); configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:SigningKey")]).Returns("E7605B2B-0D85-4575-B36C-CF3E6F1BC7D1"); configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:Issuer")]).Returns("WorkflowServer"); configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:Audience")]).Returns("WorkflowClient"); configMock.SetupGet(conf => conf[It.Is <string>(s => s == "Jwt:ExpiryInHours")]).Returns("1"); _dataContext = ContextHelper.CreateContext(_dbConnection, true); _userManager = ContextHelper.CreateUserManager(_dataContext); _authenticationService = new AuthenticationService(_userManager, configMock.Object); _vmConverter = new VmUserConverter(); }
/// <summary> /// /// </summary> /// <param name="userManager"></param> /// <param name="configuration"></param> public AuthenticationService(UserManager <ApplicationUser> userManager, IConfiguration configuration) { _userManager = userManager; _configuration = configuration; _vmConverter = new VmUserConverter(); }