public async Task ValidadaVariety() { //assign var mainValidator = new MainValidator <Variety, VarietyInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Variety1); //assert Assert.True(result.Valid); }
public async Task ValidadaSeasons() { //assign var mainValidator = new MainValidator <Season, SeasonInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Season1); //assert Assert.True(result.Valid); }
public async Task ValidadaEspecie() { //assign var mainValidator = new MainValidator <Specie, SpecieInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Specie1); //assert Assert.True(result.Valid); }
public async Task ValidatingAutomatedProductWithoutBrand() { //assign var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.ProductNewWithoutBrand); //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Equals("ProductInput.IdBrand es obligatorio")); }
public async Task ValidadaRootstock() { //assign var mainValidator = new MainValidator <Rootstock, RootstockInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Rootstock1); //assert Assert.True(result.Valid); }
public async Task ValidadaPlotland() { //assign var mainValidator = new MainValidator <PlotLand, PlotLandInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Plotland1); //assert Assert.True(result.Valid); }
public async Task ValidationAutomatedProductToEditWithIdInvalid() { //assign var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.ProductWithInvalidIdToEdit); //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Contains("no existe en la base de datos")); }
public async Task ValidationFullProductInputValid() { //assign var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.Product1); //assert Assert.True(result.Valid); }
public ResponseModel ValidateTestInsData(TestInsQueryFilter testInsQueryFilter) { try { TestValidator validator = new TestValidator(); var validationResult = validator.Validate(testInsQueryFilter); return(MainValidator.IterationValidationResult(validationResult)); } catch (Exception err) { throw new Exception(err.Message); } }
public ResponseModel ValidatePreInscripcion(PreInscripcionQueryFilter preInscripcionQueryFilter) { try { PreInscripcionValidator validator = new PreInscripcionValidator(); var validationResult = validator.Validate(preInscripcionQueryFilter); return(MainValidator.IterationValidationResult(validationResult)); } catch (Exception err) { throw new Exception(err.Message); } }
public ResponseModel ValidateId(int id) { try { IdValidator validator = new IdValidator(); var validationResult = validator.Validate(id); return(MainValidator.IterationValidationResult(validationResult)); } catch (Exception err) { throw new Exception(err.Message); } }
public async Task ValidationProductWithADosesWithWettingZero() { //assign var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); //action var result = await mainValidator.Valida(AgroInputData.ProductWithDosesWithoutWett); //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Contains("DosesInput.WettingRecommendedByHectares es obligatorio")); }
public async Task ValidaSagCodeisUnique() { var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); var prd = AgroInputData.Product1; prd.SagCode = "43322"; // usa código SAG de product2 //action var result = await mainValidator.Valida(prd); //No existe CertifiedEntity con id //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Contains("La propiedad del input ProductInput.SagCode con valor 43322 existe previamente en la base de datos")); }
public async Task ValidaNombreRepetidoInvalidoSiElNombreYaExiste() { var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); var prd = AgroInputData.Product1; prd.Id = string.Empty; prd.SagCode = "433221"; // usa código SAG de product2 prd.Name = "Producto 1"; // ya existe en la base mock. //action var result = await mainValidator.Valida(prd); //No existe CertifiedEntity con id //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Contains("La propiedad del input ProductInput.Name con valor Producto 1 existe previamente en la base de datos")); }
public async Task ValidationProductWithInvalidCertifiedEntityInsideWettingHarvest() { var mainValidator = new MainValidator <Product, ProductInput>(MockHelper.GetExistElement()); var prd = AgroInputData.Product1; var nguid = Guid.NewGuid().ToString("N"); prd.Doses[0].WaitingToHarvest[0].IdCertifiedEntity = nguid; //action var result = await mainValidator.Valida(prd); //No existe CertifiedEntity con id //assert Assert.True(result.Messages.Count() == 1 && result.Messages.First().Contains("No existe CertifiedEntity con id")); }
public IHttpActionResult Create([FromBody] LawViewModel lawViewModel) { var validation = new MainValidator().Validate(lawViewModel); if (validation.IsValid) { Lawsuit ls = new Lawsuit(); ls.SuitNumber = lawViewModel.NumeroDoProcesso; ls.SuitCreationTime = lawViewModel.dataDeCriacaoDoProcesso; ls.CourtCosts = lawViewModel.valor; ls.LawofficeId = lawViewModel.escritorioId; var result = _service.Create(ls); if (result == ServiceEnums.CreateState.Success) { return(Ok(result)); } return(StatusCode(HttpStatusCode.PartialContent)); } return(BadRequest()); }
public MainViewModel() { _mainVal = new MainValidator(); }