Skip to content

Commit

Permalink
serialization added
Browse files Browse the repository at this point in the history
  • Loading branch information
hkutluay committed Apr 19, 2020
1 parent 36861b9 commit 8258a94
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
6 changes: 0 additions & 6 deletions Ubl-Tr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UblTr", "Ubl-Tr\UblTr.cspro
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UblTr.Tests", "UblTr.Tests\UblTr.Tests.csproj", "{10AF92E9-4025-44CA-BD19-945E9ACE25F8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UblTr.Serialization", "UblTr.Serialization\UblTr.Serialization.csproj", "{A55AFFD5-A13D-479B-B7AD-040C5997EB53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -23,10 +21,6 @@ Global
{10AF92E9-4025-44CA-BD19-945E9ACE25F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{10AF92E9-4025-44CA-BD19-945E9ACE25F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{10AF92E9-4025-44CA-BD19-945E9ACE25F8}.Release|Any CPU.Build.0 = Release|Any CPU
{A55AFFD5-A13D-479B-B7AD-040C5997EB53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A55AFFD5-A13D-479B-B7AD-040C5997EB53}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A55AFFD5-A13D-479B-B7AD-040C5997EB53}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A55AFFD5-A13D-479B-B7AD-040C5997EB53}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions Ubl-Tr/Serialization/UblTrNamespaces.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Xml.Serialization;

namespace UblTr.Serialization
{
public class UblTrNamespaces : XmlSerializerNamespaces
{
public UblTrNamespaces()
{
Add("cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2");
Add("cbc", "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2");
Add("ccts", "urn:un:unece:uncefact:documentation:2");
Add("ds", "http://www.w3.org/2000/09/xmldsig#");
Add("ext", "urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2");
Add("ubltr", "urn:oasis:names:specification:ubl:schema:xsd:TurkishCustomizationExtensionComponents");
Add("qdt", "urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2");
Add("udt", "urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2");
Add("xades", "http://uri.etsi.org/01903/v1.3.2#");
Add("xsi", "http://www.w3.org/2001/XMLSchema-instance");
}
}
}
21 changes: 11 additions & 10 deletions UblTr.Tests/InvoiceTypeTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using UblTr.MainDoc;
using System.Linq;
using System;
using System.Text;
using UblTr.Serialization;

namespace UblTr.Tests
Expand Down Expand Up @@ -57,13 +56,15 @@ public void InvoiceType_CommercialInvoice_Deserialize()
[TestMethod]
public void InvoiceType_BasicInvoice_Serialize()
{
var invoice = new InvoiceType();
invoice.UUID = new Common.UUIDType() { Value = Guid.NewGuid().ToString() };
invoice.UBLVersionID = new Common.UBLVersionIDType() { Value = "2.1" };
invoice.CustomizationID = new Common.CustomizationIDType() { Value = "TR1.2" };
invoice.ProfileID = new Common.ProfileIDType() { Value = "TEMELFATURA" };
invoice.ID = new Common.IDType() { Value = "INV20200000000001" };
invoice.CopyIndicator = new Common.CopyIndicatorType() { Value = false };
var invoice = new InvoiceType
{
UUID = new Common.UUIDType() { Value = Guid.NewGuid().ToString() },
UBLVersionID = new Common.UBLVersionIDType() { Value = "2.1" },
CustomizationID = new Common.CustomizationIDType() { Value = "TR1.2" },
ProfileID = new Common.ProfileIDType() { Value = "TEMELFATURA" },
ID = new Common.IDType() { Value = "INV20200000000001" },
CopyIndicator = new Common.CopyIndicatorType() { Value = false }
};


XmlSerializer xmlSerializer = new XmlSerializer(typeof(InvoiceType));
Expand Down
1 change: 0 additions & 1 deletion UblTr.Tests/UblTr.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

<ItemGroup>
<ProjectReference Include="..\Ubl-Tr\UblTr.csproj" />
<ProjectReference Include="..\UblTr.Serialization\UblTr.Serialization.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 8258a94

Please sign in to comment.