Skip to content

Commit

Permalink
Merge pull request #37 from digipost/f_testdekning
Browse files Browse the repository at this point in the history
F testdekning - OK
  • Loading branch information
kristianenge committed Jun 1, 2015
2 parents 4af7dbf + 9be00d5 commit 728c616
Show file tree
Hide file tree
Showing 33 changed files with 879 additions and 457 deletions.
12 changes: 6 additions & 6 deletions Digipost.Api.Client.Domain/Digipost.Api.Client.Domain.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
<Compile Include="Exceptions\ConfigException.cs" />
<Compile Include="Enums\IdentificationChoice.cs" />
<Compile Include="Exceptions\XmlParseException.cs" />
<Compile Include="Identification.cs" />
<Compile Include="IdentificationResult.cs" />
<Compile Include="Identification\Identification.cs" />
<Compile Include="Identification\IdentificationResult.cs" />
<Compile Include="Enums\IdentificationResultCode.cs" />
<Compile Include="Link.cs" />
<Compile Include="Listedtime.cs" />
<Compile Include="Message.cs" />
<Compile Include="MessageDeliveryResult.cs" />
<Compile Include="Message\Message.cs" />
<Compile Include="Message\MessageDeliveryResult.cs" />
<Compile Include="Print\ForeignAddress.cs" />
<Compile Include="Print\NorwegianAddress.cs" />
<Compile Include="Print\PrintAddress.cs" />
Expand All @@ -72,8 +72,8 @@
<Compile Include="Print\PrintReturnAddress.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Enums\SensitivityLevel.cs" />
<Compile Include="Recipient.cs" />
<Compile Include="RecipientByNameAndAddress.cs" />
<Compile Include="Recipient\Recipient.cs" />
<Compile Include="Recipient\RecipientByNameAndAddress.cs" />
<Compile Include="SmsNotification.cs" />
<Compile Include="RequestContent.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,43 @@ namespace Digipost.Api.Client.Domain
[XmlType(TypeName = "identification", Namespace = "http://api.digipost.no/schema/v6")]
[XmlRoot(Namespace = "http://api.digipost.no/schema/v6", IsNullable = false)]
public class Identification : RequestContent
{

/// <summary>
/// Identify if recipient exists in Digipost by Digipost-address, organisation number or Social Security Number (SSN).
{

/// <summary>
/// Identify if recipient exists in Digipost by Digipost-address, organisation number or Social Security Number (SSN).
/// </summary>
public Identification(IdentificationChoice identificationChoice, string value)
{
if (identificationChoice == IdentificationChoice.NameAndAddress)
throw new ArgumentException(string.Format("Not allowed to set identification choice by {0} " +
"when using string as id",
IdentificationChoice.NameAndAddress.ToString()));

IdentificationValue = value;
{
if (identificationChoice == IdentificationChoice.NameAndAddress)
throw new ArgumentException(string.Format("Not allowed to set identification choice by {0} " +
"when using string as id",
IdentificationChoice.NameAndAddress.ToString()));

IdentificationValue = value;
IdentificationType = identificationChoice;
}

/// <summary>
/// Identify if recipient exists in Digipost by name and address.
/// </summary>
public Identification(IdentificationChoice identificationChoice, RecipientByNameAndAddress recipientByNameAndAddress)
{

IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
}

/// <summary>
/// Identify if recipient exists in Digipost by name and address.
/// </summary>
public Identification(RecipientByNameAndAddress recipientByNameAndAddress)
{
IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
/// <summary>
/// Identify if recipient exists in Digipost by name and address.
/// </summary>
public Identification(IdentificationChoice identificationChoice, RecipientByNameAndAddress recipientByNameAndAddress)
{

IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
}

/// <summary>
/// Identify if recipient exists in Digipost by name and address.
/// </summary>
public Identification(RecipientByNameAndAddress recipientByNameAndAddress)
{
IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
}

private Identification()
{
{
/**Must exist for serialization.**/
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace Digipost.Api.Client.Domain
{
[Serializable]
[DebuggerStepThrough]
[DesignerCategory("code")]
[XmlType(TypeName = "message", Namespace = "http://api.digipost.no/schema/v6")]
[XmlRoot(Namespace = "http://api.digipost.no/schema/v6", IsNullable = false)]
public class Message : RequestContent
{
private Message()
{
/**Must exist for serialization.**/
}

public Message(Recipient recipient, Document primaryDocument)
{
Recipient = recipient;
PrimaryDocument = primaryDocument;
Attachments = new List<Document>();
}

[XmlElement("recipient")]
public Recipient Recipient { get; set; }

[XmlElement("primary-document")]
public Document PrimaryDocument { get; set; }

[XmlElement("attachment")]
public List<Document> Attachments { get; set; }
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace Digipost.Api.Client.Domain
{
[Serializable]
[DebuggerStepThrough]
[DesignerCategory("code")]
[XmlType(TypeName = "message", Namespace = "http://api.digipost.no/schema/v6")]
[XmlRoot(Namespace = "http://api.digipost.no/schema/v6", IsNullable = false)]
public class Message : RequestContent
{
private Message()
{
/**Must exist for serialization.**/
}

public Message(Recipient recipient, Document primaryDocument)
{
Recipient = recipient;
PrimaryDocument = primaryDocument;
Attachments = new List<Document>();
}

[XmlElement("recipient")]
public Recipient Recipient { get; set; }

[XmlElement("primary-document")]
public Document PrimaryDocument { get; set; }

[XmlElement("attachment")]
public List<Document> Attachments { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public override string ToString()
return
string.Format(
"Deliverymethod: {0}, Status: {1}, Deliverytime: {2}, Primarydocument: {3}, " +
"Attachment: {4}", Deliverymethod, Status, Deliverytime, Primarydocument,
"Attachment: {4}", Deliverymethod, Status, Deliverytime, Primarydocument,
attachments);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
using Digipost.Api.Client.Domain.Enums;
using Digipost.Api.Client.Domain.Print;

namespace Digipost.Api.Client.Domain
{
[Serializable]
[DebuggerStepThrough]
[DesignerCategory("code")]
[XmlType(TypeName = "message-recipient", Namespace = "http://api.digipost.no/schema/v6")]
[XmlRoot("message-recipient", Namespace = "http://api.digipost.no/schema/v6", IsNullable = false)]
public class Recipient
{
private Recipient()
{
/**Must exist for serialization.**/
}

/// <summary>
/// Preferred digital delivery with fallback to physical delivery.
/// </summary>
public Recipient(RecipientByNameAndAddress recipientByNameAndAddress, PrintDetails printDetails = null)
{
IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
PrintDetails = printDetails;
}

/// <summary>
/// Preferred digital delivery with fallback to physical delivery.
/// </summary>
public Recipient(IdentificationChoice identificationChoice, string id, PrintDetails printDetails = null)
{
if (identificationChoice == IdentificationChoice.NameAndAddress)
throw new ArgumentException(string.Format("Not allowed to set identification choice by {0} " +
"when using string as id",
IdentificationChoice.NameAndAddress));
IdentificationValue = id;
IdentificationType = identificationChoice;
PrintDetails = printDetails;
}

/// <summary>
/// Preferred physical delivery. (not Digital)
/// </summary>
public Recipient(PrintDetails printDetails)
{
PrintDetails = printDetails;
}

[XmlElement("digipost-address", typeof (string))]
[XmlElement("name-and-address", typeof (RecipientByNameAndAddress))]
[XmlElement("organisation-number", typeof (string))]
[XmlElement("personal-identification-number", typeof (string))]
[XmlChoiceIdentifier("IdentificationType")]
public object IdentificationValue { get; set; }

[XmlElement("print-details")]
public PrintDetails PrintDetails { get; set; }

[XmlIgnore]
public IdentificationChoice IdentificationType { get; set; }
}
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;
using Digipost.Api.Client.Domain.Enums;
using Digipost.Api.Client.Domain.Print;

namespace Digipost.Api.Client.Domain
{
[Serializable]
[DebuggerStepThrough]
[DesignerCategory("code")]
[XmlType(TypeName = "message-recipient", Namespace = "http://api.digipost.no/schema/v6")]
[XmlRoot("message-recipient", Namespace = "http://api.digipost.no/schema/v6", IsNullable = false)]
public class Recipient
{
private Recipient()
{
/**Must exist for serialization.**/
}

/// <summary>
/// Preferred digital delivery with fallback to physical delivery.
/// </summary>
public Recipient(RecipientByNameAndAddress recipientByNameAndAddress, PrintDetails printDetails = null)
{
IdentificationValue = recipientByNameAndAddress;
IdentificationType = IdentificationChoice.NameAndAddress;
PrintDetails = printDetails;
}

/// <summary>
/// Preferred digital delivery with fallback to physical delivery.
/// </summary>
public Recipient(IdentificationChoice identificationChoice, string id, PrintDetails printDetails = null)
{
if (identificationChoice == IdentificationChoice.NameAndAddress)
throw new ArgumentException(string.Format("Not allowed to set identification choice by {0} " +
"when using string as id",
IdentificationChoice.NameAndAddress));
IdentificationValue = id;
IdentificationType = identificationChoice;
PrintDetails = printDetails;
}

/// <summary>
/// Preferred physical delivery. (not Digital)
/// </summary>
public Recipient(PrintDetails printDetails)
{
PrintDetails = printDetails;
}

[XmlElement("digipost-address", typeof (string))]
[XmlElement("name-and-address", typeof (RecipientByNameAndAddress))]
[XmlElement("organisation-number", typeof (string))]
[XmlElement("personal-identification-number", typeof (string))]
[XmlChoiceIdentifier("IdentificationType")]
public object IdentificationValue { get; set; }

[XmlElement("print-details")]
public PrintDetails PrintDetails { get; set; }

[XmlIgnore]
public IdentificationChoice IdentificationType { get; set; }
}
}
Loading

0 comments on commit 728c616

Please sign in to comment.