public async Task UpdateUser() { var context = AppDbContextHelper.Create(); var user = new User { Name = "Jorge", LastName = "Martinez", Email = "*****@*****.**", IsActive = true }; context.Users.Add(user); context.SaveChanges(); // Arrange var service = new UserService(context); var userDto = new UserDto { Id = 1, Name = "Jorge", LastName = "Martinez", Email = "*****@*****.**", IsActive = true }; // Act var result = await service.UpdateAsync(userDto); // Assert Assert.NotNull(result); }
public async Task GetAllUsers() { var context = AppDbContextHelper.Create(); // Arrange var service = new UserService(context); // Act var result = await service.GetAllAsync(); // Assert Assert.NotNull(result); }
public async Task GetByIdUserDontExistId() { var context = AppDbContextHelper.Create(); // Arrange var service = new UserService(context); // Act var result = await service.GetByIdAsync(-1); // Assert Assert.Null(result); }
public async Task CreateUserInvalidEmail() { var context = AppDbContextHelper.Create(); // Arrange var service = new UserService(context); var user = new UserDto { Name = "Jorge", LastName = "Martinez", Email = string.Empty, IsActive = true }; // Act var result = await service.CreateAsync(user); // Assert Assert.Null(result); }
public async Task CreateUserRequiredLastName() { var context = AppDbContextHelper.Create(); // Arrange var service = new UserService(context); var user = new UserDto { Name = "Jorge", LastName = string.Empty, Email = "*****@*****.**", IsActive = true }; // Act var result = await service.CreateAsync(user); // Assert Assert.Null(result); }
public async Task UpdateUserDontExistId() { var context = AppDbContextHelper.Create(); // Arrange var service = new UserService(context); var user = new UserDto { Id = -1, Name = "Jorge", LastName = "Martinez", Email = "*****@*****.**", IsActive = true }; // Act var result = await service.UpdateAsync(user); // Assert Assert.Null(result); }