Exemple #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);
        }
Exemple #2
0
        public void ValidationTestSuccess(string orderResName)
        {
            byte[] data;
            using (var resStream = GetType().Assembly.GetManifestResourceStream(GetType(), $"Data.Ostc2.{orderResName}"))
            {
                Assert.NotNull(resStream);
                using (var temp = new MemoryStream())
                {
                    resStream.CopyTo(temp);
                    data = temp.ToArray();
                }
            }

            var validator = new OstcExtraValidator(OstcMessageType.ApplicationData, ExtraTransportDirection.Request);

            validator.Validate(data);
        }