コード例 #1
0
        public void ValidateResponse_XMLSimple_Body_And_Header_True()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_simple.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsHeader = new List <Validation>()
                {
                    new Validation("Envelope.Header")
                    {
                        Operation = ValidationOperation.Equals,
                        Tag       = "Envelope.Header.Header.Transaccion.Canal",
                        Values    = new List <string> {
                            "1"
                        },
                    }
                },
                ValidationsBody = new List <Validation>()
                {
                    new Validation("Envelope.Body")
                    {
                        Operation = ValidationOperation.NotEquals,
                        Tag       = "Envelope.Body.ObtenerProductoResponse.ObtenerProductoResult.Precio",
                        Values    = new List <string> {
                            "3200", "2800"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, true);
        }
コード例 #2
0
        public void ValidateResponse_XMLConMultiplesEsquemas_Body_And_Header_False_Ambos()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_MultipleEsquemas.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsHeader = new List <Validation>()
                {
                    new Validation("Envelope.Header")
                    {
                        Operation = ValidationOperation.NotEquals,
                        Tag       = "Envelope.Header.Header.Transaccion.Canal",
                        Values    = new List <string> {
                            "1"
                        },
                    }
                },
                ValidationsBody = new List <Validation>()
                {
                    new Validation("Envelope.Body")
                    {
                        Operation = ValidationOperation.NotEquals,
                        Tag       = "Envelope.Body.ConsultarEstadosFolioCajaResponse.ResultadoOperacion.Codigo",
                        Values    = new List <string> {
                            "OEX-00"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, false);
        }
コード例 #3
0
        public void ValidateResponse_XMLFault_SinDefiniciones_False()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_Fault.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, false);
        }
コード例 #4
0
        public void ValidateResponse_XMLSimple_ValoNulo2_True()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_simple.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsBody = new List <Validation>()
                {
                    new Validation("Envelope.Body")
                    {
                        Operation = ValidationOperation.NotEquals,
                        Tag       = "ObtenerProductoResponse.ObtenerProductoResult.Precio",
                        Values    = new List <string> {
                            Excel.KeyNull
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, true);
        }
コード例 #5
0
        public void ValidateResponse_XMLSimple_Major_False()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_simple.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsBody = new List <Validation>()
                {
                    new Validation("Envelope.Body")
                    {
                        Operation = ValidationOperation.Major,
                        Tag       = "Envelope.Body.ObtenerProductoResponse.ObtenerProductoResult.Precio",
                        Values    = new List <string> {
                            "200", "10800"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, false);
        }
コード例 #6
0
        public void ValidateResponse_XMLFault_NombreCorto_True()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_Fault.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsFault = new List <Validation>()
                {
                    new Validation("Envelope.Body.Fault")
                    {
                        Operation = ValidationOperation.Equals,
                        Tag       = "faultcode",
                        Values    = new List <string> {
                            "soap:Server"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, true);
        }
コード例 #7
0
        public void ValidateResponse_XMLConMultiplesEsquemas_Header_False()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_MultipleEsquemas.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsHeader = new List <Validation>()
                {
                    new Validation("Envelope.Header")
                    {
                        Operation = ValidationOperation.Equals,
                        Tag       = "Envelope.Header.Header.Transaccion.Canal",
                        Values    = new List <string> {
                            "2"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, false);
        }
コード例 #8
0
        public void ValidateResponse_XMLConMultiplesEsquemas_Body_True()
        {
            string response = File.ReadAllText(Path.Combine(path, @"Files\Response_MultipleEsquemas.xml"));
            ValidationCollections validaciones = new ValidationCollections
            {
                ValidationsBody = new List <Validation>()
                {
                    new Validation("Envelope.Body")
                    {
                        Operation = ValidationOperation.Equals,
                        Tag       = "Envelope.Body.ConsultarEstadosFolioCajaResponse.ResultadoOperacion.Codigo",
                        Values    = new List <string> {
                            "OEX-00", "FUN-01", "FUN-02", "TEC-01", "TEC-03"
                        },
                    }
                }
            };

            var estado = new SoapManager(null).ValidateSection(response, validaciones);

            Assert.AreEqual <bool>(estado, true);
        }