Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }