public void DeveSer_Invalido_Quando_DataNascimento_Nao_Informada() { var command = new UsuarioBaseCommand { Nome = "Alexandre", Sobrenome = "Del Picolo", Email = "*****@*****.**", Perfil = (int)Perfil.Administrador }; var modelState = new UsuarioBaseCommandValidator().Validate(command); Assert.IsTrue(modelState.Errors.Any(x => x.PropertyName == nameof(command.DataNascimento))); }
public void DeveSer_Invalido_Quando_Email_Nao_Informado() { var command = new UsuarioBaseCommand { Nome = "Alexandre", Sobrenome = "Del Picolo", DataNascimento = DateTime.Now.AddYears(-1), Perfil = (int)Perfil.Administrador }; var modelState = new UsuarioBaseCommandValidator().Validate(command); Assert.IsTrue(modelState.Errors.Any(x => x.PropertyName == nameof(command.Email))); }
public void DeveSer_Invalido_Quando_Nome_Menor_Que_Tres_Caracteres() { var command = new UsuarioBaseCommand { Nome = "12", Sobrenome = "Del Picolo", Email = "*****@*****.**", DataNascimento = DateTime.Now.AddYears(-1), Perfil = (int)Perfil.Administrador }; var modelState = new UsuarioBaseCommandValidator().Validate(command); Assert.IsTrue(modelState.Errors.Any(x => x.PropertyName == nameof(command.Nome))); }
public void DeveSer_Invalido_Quando_Perfil_Nao_Existe() { var command = new UsuarioBaseCommand { Nome = "Alexandre", Sobrenome = "Del Picolo", Email = "*****@*****.**", DataNascimento = DateTime.Now.AddYears(-1), Perfil = 99 }; var modelState = new UsuarioBaseCommandValidator().Validate(command); Assert.IsTrue(modelState.Errors.Any(x => x.PropertyName == nameof(command.Perfil))); }