示例#1
0
        public void ValidationTestFailure()
        {
            var order = new OstcAntrag()
            {
                Antragsteller = new OstcAntragAntragsteller()
                {
                    IK_BN = "12345678",
                },
            };
            var encoding = Encoding.GetEncoding("iso-8859-1");
            var data     = OstcUtils.Serialize(order, encoding);

            var validator = new OstcExtraValidator(OstcMessageType.ApplicationData, ExtraTransportDirection.Request);
            var ex        = Assert.Throws <XmlSchemaValidationException>(() => validator.Validate(data));

            Assert.Equal("The 'IK_BN' element is invalid - The value '12345678' is invalid according to its datatype 'sType_an10_11' - The actual length is less than the MinLength value.", ex.Message);
        }
示例#2
0
        public void ValidationTestSuccess()
        {
            var now   = DateTime.Now;
            var order = new OstcAntrag()
            {
                Trustcenter = new OstcAntragTrustcenter()
                {
                    Eingangsnummer = string.Empty,
                    Returncode     = string.Empty,
                },
                Antragsteller = new OstcAntragAntragsteller()
                {
                    IK_BN    = "1234567890",
                    Firma    = "Firma",
                    Anrede   = "Anrede",
                    Nachname = "Nachname",
                    Strasse  = "Strasse",
                    PLZ      = "12345",
                    Ort      = "Berlin",
                    Telefon  = "0123456789",
                    Email    = "*****@*****.**",
                    Kennwort = "customer password",
                },
                Antragsinfo = new OstcAntragAntragsinfo()
                {
                    Ruecksendung  = "10",
                    Generierung   = "40",
                    Sperrung      = "1",
                    Softwarehaus  = "manufacturer",
                    Fachanwendung = "product",
                    Datum         = now.ToString("dd.MM.yyyy", _cultureDe),
                    Uhrzeit       = now.ToString("HH:mm:ss", _cultureDe),
                },
                Rechnungsadresse = new OstcAntragRechnungsadresse(),
            };
            var encoding = Encoding.GetEncoding("iso-8859-1");
            var data     = OstcUtils.Serialize(order, encoding);

            var validator = new OstcAntragValidator();

            validator.Validate(data);
        }
示例#3
0
        public void ValidationTestFailure()
        {
            var order = new OstcAntrag()
            {
                Trustcenter = new OstcAntragTrustcenter()
                {
                    Eingangsnummer = string.Empty,
                    Returncode     = string.Empty,
                },
                Antragsteller = new OstcAntragAntragsteller()
                {
                    IK_BN = "12345678",
                },
            };
            var encoding = Encoding.GetEncoding("iso-8859-1");
            var data     = OstcUtils.Serialize(order, encoding);

            var validator = new OstcAntragValidator();
            var ex        = Assert.Throws <XmlSchemaValidationException>(() => validator.Validate(data));

            Assert.Equal("The 'IK_BN' element is invalid - The value '12345678' is invalid according to its datatype 'sType_an10_11' - The actual length is less than the MinLength value.", ex.Message);
        }