public void ValidateExistUser() { var user = new User { BirthDate = DateTime.Now.AddYears(-20), Cpf = "56602275038", Name = "Amilton Nobregas", Password = "******" }; var context = new ContextFake().CreateContext(); var repostorio = new UserRepository(context); repostorio.AddAsync(user).Wait(); context.SaveChanges(); var userModel = new UserModel { BirthDate = DateTime.Now.AddYears(-20), Cpf = "56602275038", Name = "Amilton Nobregas", Password = "******", }; var result = _userValidation.ValidateModel(userModel); Assert.False(result.Success); repostorio.Delete(user).Wait(); context.SaveChanges(); }
public UserValidationTest() { var fakeContext = new ContextFake().CreateContext(); var userRepository = (IUserRepository) new UserRepository(fakeContext); var configurationRepository = (IConfigurationRepository) new ConfigurationRepository(fakeContext); _userValidation = new UserValidation(userRepository, configurationRepository); _dataFake = new DataFake(); }