Пример #1
0
        public void ReadInvoiceBogusNode()
        {
            string      filename = "InvoiceBogusXml.xml";
            InvoiceType doc      = UblDoc <InvoiceType> .Create(filename);

            Assert.AreEqual(null, doc, "Should not be possible to read malformed xml");
        }
Пример #2
0
        public void ReadRemittanceAdvice()
        {
            string filename          = "UBL-RemittanceAdvice-2.0-Example.xml";
            RemittanceAdviceType doc = UblDoc <RemittanceAdviceType> .Create(filename);

            Assert.AreEqual("849FBBCE-E081-40B4-906C-94C5FF9D1AC3", (string)doc.RemittanceAdviceLine[0].BillingReference[0].InvoiceDocumentReference.UUID);
            bool areEqual = UblXmlComparer.IsCopyEqual <RemittanceAdviceType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #3
0
        public void ReadRequestForQuotation()
        {
            string filename             = "UBL-RequestForQuotation-2.0-Example.xml";
            RequestForQuotationType doc = UblDoc <RequestForQuotationType> .Create(filename);

            Assert.AreEqual("56A", doc.Delivery[0].DeliveryAddress.BuildingNumber.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <RequestForQuotationType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #4
0
        public void ReadReceiptAdvice()
        {
            string            filename = "UBL-ReceiptAdvice-2.0-Example.xml";
            ReceiptAdviceType doc      = UblDoc <ReceiptAdviceType> .Create(filename);

            Assert.AreEqual("Heremouthshire", (string)doc.DespatchSupplierParty.Party.PostalAddress.CountrySubentity);
            bool areEqual = UblXmlComparer.IsCopyEqual <ReceiptAdviceType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #5
0
        public void ReadQuotation()
        {
            string        filename = "UBL-Quotation-2.0-Example.xml";
            QuotationType doc      = UblDoc <QuotationType> .Create(filename);

            Assert.AreEqual("Busy Street", doc.SellerSupplierParty.Party.PostalAddress.StreetName.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <QuotationType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #6
0
        public void ReadOrderresponseSimple()
        {
            string filename             = "UBL-OrderResponseSimple-2.0-Example.xml";
            OrderResponseSimpleType doc = UblDoc <OrderResponseSimpleType> .Create(filename);

            Assert.AreEqual("Farthing Purchasing Consortia", doc.SellerSupplierParty.Party.PartyTaxScheme[0].RegistrationName.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <OrderResponseSimpleType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #7
0
        public void ReadOrder()
        {
            string    filename = "UBL-Order-2.0-Example.xml";
            OrderType doc      = UblDoc <OrderType> .Create(filename);

            Assert.AreEqual("*****@*****.**", doc.SellerSupplierParty.Party.Contact.ElectronicMail.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <OrderType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #8
0
        public void ReadWaybillInternational()
        {
            string      filename = "UBL-Waybill-2.0-Example-International.xml";
            WaybillType doc      = UblDoc <WaybillType> .Create(filename);

            Assert.AreEqual("urn:oasis:names:specification:ubl:xpath:Waybill-2.0:samples-2.0-draft", doc.CustomizationID.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <WaybillType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #9
0
        public void ReadOrderInternational()
        {
            string    filename = "UBL-Order-2.0-Example-International.xml";
            OrderType doc      = UblDoc <OrderType> .Create(filename);

            Assert.AreEqual("Mrs Bouquet", doc.SellerSupplierParty.Party.Contact.Name.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <OrderType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #10
0
        public void ReadNorwegianCreditNote()
        {
            string         filename = "BII05 T14 0 gyldig kreditnota med alle elementer.xml";
            CreditNoteType doc      = UblDoc <CreditNoteType> .Create(filename);

            Assert.AreEqual("5645342123", doc.AccountingCustomerParty.Party.PartyLegalEntity[0].CompanyID.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <CreditNoteType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #11
0
        public void ReadNorwegianInvoice()
        {
            string      filename = "BII04 T10 gyldig faktura med alle elementer.xml";
            InvoiceType doc      = UblDoc <InvoiceType> .Create(filename);

            Assert.AreEqual("Accounting department", doc.AccountingCustomerParty.Party.PostalAddress.Department.Value);
            bool areEqual = UblXmlComparer.IsCopyEqual <InvoiceType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #12
0
        public void ReadForwardingInstructionInternational()
        {
            string filename = "UBL-ForwardingInstructions-2.0-Example-International.xml";
            ForwardingInstructionsType doc = UblDoc <ForwardingInstructionsType> .Create(filename);

            Assert.AreEqual("Mr Fred Churchill", doc.Shipment.Consignment[0].ConsigneeParty.Contact.Name.Value);

            bool areEqual = UblXmlComparer.IsCopyEqual <ForwardingInstructionsType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #13
0
        public void ReadStatement()
        {
            string        filename = "UBL-Statement-2.0-Example.xml";
            StatementType doc      = UblDoc <StatementType> .Create(filename);

            UblLarsen.Ubl2.Udt.AmountType line = doc.StatementLine[0].CreditLineAmount;
            Assert.AreEqual(107.50M, line.Value);
            Assert.AreEqual("GBP", line.currencyID);
            bool areEqual = UblXmlComparer.IsCopyEqual <StatementType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #14
0
        public void ReadInvoice()
        {
            string      filename = "UBL-Invoice-2.0-Example.xml";
            InvoiceType doc      = UblDoc <InvoiceType> .Create(filename);

            string name = doc.AccountingCustomerParty.Party.PartyName[0].Name; //.Value; use implicit string conversion

            Assert.AreEqual(name, "IYT Corporation");

            bool areEqual = UblXmlComparer.IsCopyEqual <InvoiceType>(filename, doc);

            Assert.IsTrue(areEqual, "Written invoice differs from the one read");
        }
Пример #15
0
        public void ReadCreditNote()
        {
            string         filename = "UBL-CreditNote-2.0-Example.xml";
            CreditNoteType doc      = UblDoc <CreditNoteType> .Create(filename);

            string value = doc.AccountingCustomerParty.Party.PartyName[0].Name;

            Assert.AreEqual("IYT Corporation", value);

            bool areEqual = UblXmlComparer.IsCopyEqual <CreditNoteType>(filename, doc);

            Assert.IsTrue(areEqual, "Written UBL doc differs from original");
        }
Пример #16
0
        public void Write1000InvoicesToMem()
        {
            int count = 1000;

            MemoryStream[] buffer = new MemoryStream[count];
            for (int i = 0; i < count; i++)
            {
                buffer[i] = new MemoryStream(0x4000);
            }
            InvoiceType[] docs =
            {
                UblDoc <InvoiceType> .Create("UBL-Invoice-2.0-Example.xml"),
                UblDoc <InvoiceType> .Create("BII04 T10 gyldig faktura med alle elementer.xml")
            };
            // Testrun to initialize just in case this is the only test we run
            using (MemoryStream ms = new MemoryStream(0x4000))
            {
                UblDoc <InvoiceType> .Save(ms, docs[0]);
            }

            // Now the real timed test
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            for (int i = 0; i < count; i++)
            {
                UblDoc <InvoiceType> .Save(buffer[i], docs[i % 2]);
            }
            stopWatch.Stop();

            for (int i = 0; i < count; i++)
            {
                buffer[i].Dispose();
            }
            this.TestContext.WriteLine("Time writing {0} invoices to memory: {1}", count, stopWatch.Elapsed.ToString("G"));
        }
Пример #17
0
 public void ReadWrongDocTypeByMistake()
 {
     string         filename = "UBL-Invoice-2.0-Example.xml"; // This is not a credit note, next codeline must fail
     CreditNoteType doc      = UblDoc <CreditNoteType> .Create(filename);
 }