Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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"));
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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"));
        }
Пример #9
0
        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"));
        }
Пример #10
0
        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"));
        }
Пример #11
0
        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"));
        }
Пример #12
0
        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"));
        }