public void TestNoneContext() { #region inner document var innerDocument = new InnerDocument { OrdersNumber = "Orders123", OrdersDate = new DateTime(2014, 11, 22, 0, 0, 0, DateTimeKind.Utc), BlanketOrdersNumber = "bo123", Contracts = new[] { new ContractInfo { ContractNumber = "CN1", ContractDate = new DateTime(2014, 04, 04, 0, 0, 0, DateTimeKind.Utc), }, null, new ContractInfo { ContractNumber = "CN2", ContractDate = new DateTime(2014, 05, 05, 0, 0, 0, DateTimeKind.Utc), }, }, Supplier = new PartyInfo { Gln = "supplier gln", RussianPartyInfo = new RussianPartyInfo { RussianPartyType = RussianPartyType.UL, ULInfo = new UlInfo { Inn = "supplier inn", OKPOCode = "supplier okpo", Name = "Very long supplier name for ArrayStringConverterTest", }, }, PartyAddress = new PartyAddress { AddressType = AddressType.Russian, RussianAddressInfo = new RussianAddressInfo { City = "City", Village = "Village", Street = "Street", House = "House", Flat = "Flat", RegionCode = "R1", District = "D1", } }, BankAccount = new BankAccount { BankAccountNumber = "bn1", CorrespondentAccountNumber = "cn1", BankName = "Bank", }, }, Buyer = new PartyInfo { Gln = "buyer gln", RussianPartyInfo = new RussianPartyInfo { RussianPartyType = RussianPartyType.IP, IPInfo = new IpInfo { Inn = "buyer inn", OKPOCode = "buyer okpo", FirstName = "First", LastName = "Last", MiddleName = "Middle", } }, PartyAddress = new PartyAddress { AddressType = AddressType.Foreign, ForeignAddressInfo = new ForeignAddressInfo { CountryCode = "121", Address = "Some Foreign Address", } }, BankAccount = new BankAccount { BankAccountNumber = null, CorrespondentAccountNumber = "cn2", BankName = null, }, }, GoodItems = new[] { new CommonGoodItem { GTIN = "GTIN 1", BuyerProductId = "bid1", SupplierProductId = null, Quantity = new InnerQuantity { Value = 12.34m, MeasurementUnitCode = "PCE", }, PriceSummary = 0.12m, SerialNumber = "SN1", }, new CommonGoodItem { GTIN = "GTIN 2", BuyerProductId = null, SupplierProductId = "sid2", FlowType = "Flow type", Comment = "Comment", Quantity = new InnerQuantity { Value = 133.10m, MeasurementUnitCode = "KGM", }, }, }, }; #endregion #region second contract var secondContractDocument = new SecondContractDocument <SecondContractDocumentBody> { SG0 = new[] { new SecondContractDocumentBody { BeginningOfMessage = new BeginningOfMessage { DocumentMessageIdentification = new DocumentMessageIdentification { DocumentIdentifier = "Orders123", } }, DateTimePeriod = new[] { new DateTimePeriod { DateTimePeriodGroup = new DateTimePeriodGroup { FormatCode = "203", FunctionCodeQualifier = "137", Value = "201411220000", }, } }, References = new[] { new SG1 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "ON", ReferenceIdentifier = "Orders123", }, }, DateTimePeriod = new[] { new DateTimePeriod { DateTimePeriodGroup = new DateTimePeriodGroup { Value = "201411220000", FunctionCodeQualifier = "171", FormatCode = "203", } } } }, new SG1 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "BO", ReferenceIdentifier = "bo123", }, }, DateTimePeriod = new DateTimePeriod[] { null }, }, new SG1 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "CT", ReferenceIdentifier = "CN1", }, }, DateTimePeriod = new[] { new DateTimePeriod { DateTimePeriodGroup = new DateTimePeriodGroup { FormatCode = "203", FunctionCodeQualifier = "171", Value = "201404040000", } } }, }, new SG1 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "CT", ReferenceIdentifier = "CN2", }, }, DateTimePeriod = new[] { new DateTimePeriod { DateTimePeriodGroup = new DateTimePeriodGroup { FormatCode = "203", FunctionCodeQualifier = "171", Value = "201405050000", } } }, } }, PartiesArray = new[] { new SG2 { NameAndAddress = new NameAndAddress { PartyFunctionCodeQualifier = "SU", PartyIdentificationDetails = new PartyIdentificationDetails { PartyIdentifier = "supplier gln", }, PartyNameType = new PartyNameType { PartyName = new[] { "Very long supplier name for ArraySt", "ringConverterTest" }, PartyNameFormatCode = "UL", }, Street = new Street { StreetAndNumberOrPostBoxIdentifier = new[] { "Street; House; Flat" } }, CountryNameCode = "643", CityName = "City, Village", CountrySubEntityDetails = new CountrySubEntityDetails { CountrySubEntityName = "R1, D1", }, }, References = new[] { new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "FC", ReferenceIdentifier = "supplier inn", } } }, new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "GN", ReferenceIdentifier = "supplier okpo", } } }, }, FinancialInstitutionInformation = new[] { new FinancialInstitutionInformation { PartyFunctionCodeQualifier = "BK", HolderIdentification = new HolderIdentificationType { HolderIdentification = "bn1", HolderName = new[] { "cn1" }, }, InstitutionIdentification = new InstitutionIdentification { InstitutionName = "Bank", }, }, }, }, new SG2 { NameAndAddress = new NameAndAddress { PartyFunctionCodeQualifier = "BY", PartyIdentificationDetails = new PartyIdentificationDetails { PartyIdentifier = "buyer gln", }, PartyNameType = new PartyNameType { PartyName = new[] { "Last", "First", "Middle" }, PartyNameFormatCode = "IP", }, Street = new Street { StreetAndNumberOrPostBoxIdentifier = new[] { "Some Foreign Address" } }, CountryNameCode = "121", CountrySubEntityDetails = new CountrySubEntityDetails { }, }, References = new[] { new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "FC", ReferenceIdentifier = "buyer inn", } } }, new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "GN", ReferenceIdentifier = "buyer okpo", } } }, }, FinancialInstitutionInformation = new[] { new FinancialInstitutionInformation { HolderIdentification = new HolderIdentificationType { HolderName = new string[1], }, InstitutionIdentification = new InstitutionIdentification(), }, }, }, }, SG13 = new[] { new SG13 { Package = new Package { PackageType = new PackageType(), } } }, SG28 = new[] { new SG28 { LineItem = new LineItem { LineItemIdentifier = "1", ItemNumberIdentification = new ItemNumberIdentification { ItemIdentifier = "GTIN 1", }, }, AdditionalProductId = new[] { new AdditionalProductId { ItemNumberIdentification = new[] { new ItemNumberIdentification { ItemTypeIdentificationCode = "IN", ItemIdentifier = "bid1", }, }, ProductIdentifierCodeQualifier = "z", }, new AdditionalProductId { ItemNumberIdentification = new[] { new ItemNumberIdentification(), }, }, }, Quantity = new[] { new SecondContractQuantity { QuantityDetails = new QuantityDetails { Quantity = "12.34", MeasurementUnitCode = "PCE", }, }, }, DateTimePeriod = new DateTimePeriod[1], MonetaryAmount = new[] { new MonetaryAmount { MonetaryAmountGroup = new MonetaryAmountGroup { MonetaryAmountTypeCodeQualifier = "203", MonetaryAmount = "0.1200", } } }, FreeText = new FreeText[0], GoodsIdentityNumber = new[] { new GoodsIdentityNumber { ObjectIdentificationCodeQualifier = "BN", IdentityNumberRange = new[] { new IdentityNumberRange { ObjectIdentifier = new[] { "SN1" }, } } } } }, new SG28 { LineItem = new LineItem { LineItemIdentifier = "2", ItemNumberIdentification = new ItemNumberIdentification { ItemIdentifier = "GTIN 2", }, }, AdditionalProductId = new[] { new AdditionalProductId { ItemNumberIdentification = new[] { new ItemNumberIdentification() }, }, new AdditionalProductId { ItemNumberIdentification = new[] { new ItemNumberIdentification { ItemTypeIdentificationCode = "SA", ItemIdentifier = "sid2", }, }, ProductIdentifierCodeQualifier = "q", }, }, Quantity = new[] { new SecondContractQuantity { QuantityDetails = new QuantityDetails { Quantity = "133.10", MeasurementUnitCode = "KGM", }, }, }, DateTimePeriod = new DateTimePeriod[1], MonetaryAmount = new[] { new MonetaryAmount { MonetaryAmountGroup = new MonetaryAmountGroup { MonetaryAmountTypeCodeQualifier = "203", MonetaryAmount = "", } } }, FreeText = new[] { new FreeText { TextSubjectCodeQualifier = "DEL", TextLiteral = new TextLiteral { FreeTextValue = new[] { "Flow type" } }, TextReference = new TextReference { FreeTextValueCode = "ZZZ", }, }, new FreeText { TextSubjectCodeQualifier = "ACB", TextLiteral = new TextLiteral { FreeTextValue = new[] { "Comment" } }, TextReference = new TextReference(), }, }, }, }, ControlTotal = new[] { new ControlTotal { Control = new Control { ControlTotalValue = "145.44", } } } }, } }; #endregion var converter = converterCollection.GetConverter(new TestConverterContext()); converter(innerDocument).Should().BeEquivalentTo(secondContractDocument); }
public void TestNoneContext() { #region second contract var secondContractDocument = new SecondContractDocument <SecondContractDocumentBody> { SG0 = new[] { new SecondContractDocumentBody { BeginningOfMessage = new BeginningOfMessage { DocumentMessageIdentification = new DocumentMessageIdentification { DocumentIdentifier = "Message123", }, }, ControlTotal = new[] { new ControlTotal { Control = new Control { ControlTotalTypeCodeQualifier = "1", ControlTotalValue = "10.1", }, }, new ControlTotal { Control = new Control { ControlTotalTypeCodeQualifier = "11", ControlTotalValue = "12.34", }, }, }, Currency = new Currencies { CurrencyDetails = new[] { new CurrencyDetails { UsageCodeQualifier = "1", TypeCodeQualifier = "2", IdentificationCode = "first", }, new CurrencyDetails { UsageCodeQualifier = "2", TypeCodeQualifier = "4", IdentificationCode = "second", }, new CurrencyDetails { UsageCodeQualifier = "2", TypeCodeQualifier = "4", IdentificationCode = "third", }, } }, FreeText = new[] { new FreeText { TextSubjectCodeQualifier = "PUR", TextLiteral = new TextLiteral { FreeTextValue = new[] { "purchasing", " info" }, }, } }, References = new[] { new SG1 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceIdentifier = "blanket number", ReferenceCodeQualifier = "BO", }, }, }, }, SG10 = new[] { new SG10 { DetailsOfTransport = new DetailsOfTransport { TransportStageCodeQualifier = "1", TransportIdentification = new TransportIdentification { TransportMeansIdentificationName = "vehicle number", }, }, }, new SG10 { DetailsOfTransport = new DetailsOfTransport { TransportStageCodeQualifier = "20", TransportMeans = new TransportMeans { TransportMeansDescription = "transport means", TransportMeansDescriptionCode = "transport means code", }, }, SG11 = new[] { new SG11 { DateTimePeriod = new[] { new DateTimePeriod { DateTimePeriodGroup = new DateTimePeriodGroup { FunctionCodeQualifier = "232", FormatCode = "102", Value = "20130314", } }, }, }, }, }, }, SG28 = new[] { new SG28 { FreeText = new[] { new FreeText { TextSubjectCodeQualifier = "DEL", TextReference = new TextReference { CodeListResponsibleAgencyCode = "ZZZ", FreeTextValueCode = "flow type", }, }, }, ItemDescription = new[] { new ItemDescription { DescriptionFormatCode = "C", ItemDescriptionGroup = new ItemDescriptionGroup { ItemDescriptionCode = "RC", ItemDescription = new[] { "first ", "good item", " name" } }, }, }, LineItem = new LineItem { ItemNumberIdentification = new ItemNumberIdentification { ItemIdentifier = "GTIN 1" }, }, AdditionalProductId = new[] { new AdditionalProductId { ItemNumberIdentification = new[] { new ItemNumberIdentification { ItemIdentifier = "additional id1", ItemTypeIdentificationCode = "STB", }, }, ProductIdentifierCodeQualifier = "5", }, }, MonetaryAmount = new[] { new MonetaryAmount { MonetaryAmountGroup = new MonetaryAmountGroup { MonetaryAmountTypeCodeQualifier = "161", MonetaryAmount = "22.33", }, }, }, AdditionalInformation = new[] { new AdditionalInformation { CountryOfOriginNameCode = "DefaultCountry", }, new AdditionalInformation { CountryOfOriginNameCode = "country", }, }, SG34 = new[] { new SG34 { Package = new Package { PackageType = new PackageType { PackageTypeDescriptionCode = "default", }, PackageQuantity = "321.3", }, Quantity = new[] { new Quantity { QuantityDetails = new QuantityDetails { QuantityTypeCodeQualifier = "52", Quantity = "0.01", MeasurementUnitCode = "DEFAULT", }, }, }, }, new SG34 { Package = new Package { PackageType = new PackageType { PackageTypeDescriptionCode = "package type code", }, PackageQuantity = "324.3", }, Quantity = new[] { new Quantity { QuantityDetails = new QuantityDetails { QuantityTypeCodeQualifier = "52", Quantity = "0.02", MeasurementUnitCode = "PCE", }, }, }, } }, }, }, MonetaryAmount = new[] { new MonetaryAmount { MonetaryAmountGroup = new MonetaryAmountGroup { MonetaryAmountTypeCodeQualifier = "79", MonetaryAmount = "34.21", }, }, new MonetaryAmount { MonetaryAmountGroup = new MonetaryAmountGroup { MonetaryAmountTypeCodeQualifier = "9", MonetaryAmount = "3.14", }, }, }, PartiesArray = new[] { new SG2 { NameAndAddress = new NameAndAddress { PartyFunctionCodeQualifier = "PW", PartyIdentificationDetails = new PartyIdentificationDetails { PartyIdentifier = "GLN", }, PartyNameType = new PartyNameType { PartyName = new[] { "last name", "first name" }, PartyNameFormatCode = "IN", }, CountryNameCode = "foreign country code", Street = new Street { StreetAndNumberOrPostBoxIdentifier = new[] { "street ", "number ", "postbox" } }, PostalIdentificationCode = "post code", }, References = new[] { new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "YC1", ReferenceIdentifier = "Supplier Code", }, }, }, new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "FC", ReferenceIdentifier = "inn ip", }, }, }, }, ContactInformationArray = new[] { new SG5 { ContactInformation = new ContactInformation { ContactFunctionCode = "MGR", DepartmentOrEmployeeDetails = new DepartmentOrEmployeeDetails { DepartmentOrEmployeeName = "chief name", }, }, CommunicationContact = new[] { new CommunicationContact { CommunicationContactGroup = new CommunicationContactGroup { CommunicationAddressCodeQualifier = "TE", CommunicationAddressIdentifier = "phone", }, }, }, }, }, FinancialInstitutionInformation = new[] { new FinancialInstitutionInformation { PartyFunctionCodeQualifier = "BK", HolderIdentification = new HolderIdentificationType { HolderIdentification = "bank account number", }, }, }, }, new SG2 { NameAndAddress = new NameAndAddress { PartyFunctionCodeQualifier = "PW", PartyIdentificationDetails = new PartyIdentificationDetails { PartyIdentifier = "GLN1", }, PartyNameType = new PartyNameType { PartyName = new[] { "ul ", "name" }, PartyNameFormatCode = "LE", }, CountryNameCode = null, Street = new Street { StreetAndNumberOrPostBoxIdentifier = new[] { "str", "eet" }, }, PostalIdentificationCode = "post code", CityName = "city", }, References = new[] { new SG3 { Reference = new Reference { ReferenceGroup = new ReferenceGroup { ReferenceCodeQualifier = "FC", ReferenceIdentifier = "inn ul", }, }, }, }, } }, }, }, }; #endregion #region inner document var innerDocument = new InnerDocument { OrdersNumber = "Message123", CurrencyCode = "second", FlowType = "flow type", TransportDetails = new TransportDetails { VehicleNumber = "vehicle number", }, FreeText = "purchasing info", Transports = new[] { new TransportDetails { TypeOfTransport = "transport means", TypeOfTransportCode = "transport means code", DeliveryDateForVehicle = new DateTime(2013, 03, 14, 0, 0, 0, DateTimeKind.Utc), }, }, DespatchParties = new[] { new DespatchPartyInfo { PartyInfo = new PartyInfo { Gln = "GLN", SupplierCodeInBuyerSystem = "Supplier Code", PartyAddress = new PartyAddress { AddressType = AddressType.Foreign, RussianAddressInfo = new RussianAddressInfo(), ForeignAddressInfo = new ForeignAddressInfo { CountryCode = "foreign country code", Address = "street number postbox", }, }, RussianPartyInfo = new RussianPartyInfo { RussianPartyType = RussianPartyType.IP, IPInfo = new IpInfo { LastName = "last name", FirstName = "first name", Inn = "inn ip", }, ULInfo = new UlInfo(), }, BankAccount = new BankAccount { BankAccountNumber = "bank account number", }, Chief = new InnerContract.ContactInformation { Name = "chief name", Phone = "phone", }, }, }, new DespatchPartyInfo { PartyInfo = new PartyInfo { Gln = "GLN1", PartyAddress = new PartyAddress { AddressType = AddressType.Russian, RussianAddressInfo = new RussianAddressInfo { Street = "street", City = "city", }, ForeignAddressInfo = new ForeignAddressInfo(), }, RussianPartyInfo = new RussianPartyInfo { RussianPartyType = RussianPartyType.UL, IPInfo = new IpInfo(), ULInfo = new UlInfo { Inn = "inn ul", Name = "ul name", }, }, BankAccount = new BankAccount(), Chief = new InnerContract.ContactInformation(), }, } }, BlanketOrdersNumber = "blanket number", OrdersTotalPackageQuantity = 12.34m, RecadvTotal = 34.21m, TotalWithVAT = 3.14m, GoodItems = new[] { new CommonGoodItem { GoodNumber = new GoodNumber { Number = 1 }, Name = "first good item name", GTIN = "GTIN 1", AdditionalId = "additional id1", CountriesOfOriginCode = new[] { null, "country" }, IsReturnableContainer = true, TypeOfUnit = "RC", ExciseTax = 22.33m, Packages = new[] { new PackageForItem { PackageTypeCode = null, OnePackageQuantity = new InnerContract.Quantity { Value = 0.01m, MeasurementUnitCode = "DME", }, Quantity = 321.3m, }, new PackageForItem { PackageTypeCode = "package type code", OnePackageQuantity = new InnerContract.Quantity { Value = 0.02m, MeasurementUnitCode = "PCE", }, Quantity = 324.3m, }, }, }, }, }; #endregion var converter = converterCollection.GetConverter(new TestConverterContext()); converter(secondContractDocument).Should().BeEquivalentTo(innerDocument, config => config.Excluding(x => x.OrdersDate)); }