public async Task UserByEmailAsync_HasNoUser_ReturnsNull_OkAsync() { using (var context = InMemoryDatabaseHelper.GetDbContext()) { var userREpo = new UserRepositoryForIdentity(context, AutomapperSingleton.Mapper); await new ApplicationUserFactory(Role.Employee, email: "*****@*****.**") .BuildAsync(context); var target = new UserServiceForIdentityServer(userREpo); Assert.Null(await target.UserByEmailOrNullAsync("No_email_like_this")); } }
public async Task UserByEmailAsync_HasUser_BeingReturned_OkAsync() { using (var context = InMemoryDatabaseHelper.GetDbContext()) { var userREpo = new UserRepositoryForIdentity(context, AutomapperSingleton.Mapper); var addedUser = await new ApplicationUserFactory(Role.Employee, email: "*****@*****.**") .BuildAsync(context); var target = new UserServiceForIdentityServer(userREpo); var user = await target.UserByEmailOrNullAsync("*****@*****.**"); Assert.NotNull(user); Assert.Equal(addedUser.Id, user.Id); Assert.Equal(Role.Employee, user.Role); } }