public void Message()
            {
                //Arrange
                var source = DomainUtility.GetMessageWithBytesAndStaticGuidRecipientById();

                var expectedDto = DomainUtility.GetMessageDataTransferObjectWithBytesAndStaticGuidRecipientById();

                //Act
                var actualDto = SendDataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
            public void ReturnsCorrectDataForMessage()
            {
                //Arrange
                var message = DomainUtility.GetSimpleMessageWithRecipientById();

                //Act
                var action  = new MessageAction(message);
                var content = action.RequestContent;

                //Assert
                var expected = SerializeUtil.Serialize(SendDataTransferObjectConverter.ToDataTransferObject(message));

                Assert.Equal(expected, content.InnerXml);
            }
            public void Invoice()
            {
                //Arrange
                var contentBytes    = new byte[] { 0xb2 };
                var smsNotification = new SmsNotification(DateTime.Today.AddHours(3));

                var source = new Invoice(
                    "subject",
                    "txt",
                    contentBytes,
                    100,
                    "8902438456",
                    DateTime.Today,
                    "123123123",
                    AuthenticationLevel.TwoFactor,
                    SensitivityLevel.Sensitive,
                    smsNotification);

                var expectedDto = new
                                  invoice
                {
                    subject                      = source.Subject,
                    filetype                     = source.FileType,
                    authenticationlevel          = source.AuthenticationLevel.ToAuthenticationLevel(),
                    authenticationlevelSpecified = true,
                    sensitivitylevel             = source.SensitivityLevel.ToSensitivityLevel(),
                    sensitivitylevelSpecified    = true,
                    smsnotification              = new smsnotification {
                        at = new[] { new listedtime {
                                         time = smsNotification.NotifyAtTimes.First(), timeSpecified = true
                                     } }
                    },
                    uuid    = source.Guid,
                    kid     = source.Kid,
                    amount  = source.Amount,
                    account = source.Account,
                    duedate = source.Duedate
                };

                //Act
                var actualDto = SendDataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
            public void MessageWithPrintDetailsAndRecipientById()
            {
                //Arrange
                var printDetails = DomainUtility.GetPrintDetails();
                var source       = DomainUtility.GetMessageWithBytesAndStaticGuidRecipientById();

                source.PrintDetails = printDetails;

                var expectedDto = DomainUtility.GetMessageDataTransferObjectWithBytesAndStaticGuidRecipientById();

                expectedDto.recipient.printdetails = DomainUtility.GetPrintDetailsDataTransferObject();

                //Act
                var actualDto = SendDataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
            public void Document()
            {
                //Arrange
                IDocument source      = new Document("TestSubject", "txt", new byte[2], AuthenticationLevel.Password, SensitivityLevel.Sensitive, new SmsNotification(3));
                var       expectedDto = new document
                {
                    subject                      = source.Subject,
                    filetype                     = source.FileType,
                    authenticationlevel          = source.AuthenticationLevel.ToAuthenticationLevel(),
                    authenticationlevelSpecified = true,
                    sensitivitylevel             = source.SensitivityLevel.ToSensitivityLevel(),
                    sensitivitylevelSpecified    = true,
                    smsnotification              = new smsnotification {
                        afterhours = source.SmsNotification.NotifyAfterHours.ToArray()
                    },
                    uuid = source.Guid
                };

                //Act
                var actualDto = SendDataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
            public void MessageWithPrintIfUnread()
            {
                //Arrange
                var printDetails = DomainUtility.GetPrintDetails();
                var sender       = new Sender(1010);
                var deadline     = DateTime.Now.AddDays(6);
                var source       = new Message(
                    sender,
                    DomainUtility.GetRecipientByNameAndAddress(),
                    new Document("PrimaryDocument subject", "txt", new byte[3])
                    )
                {
                    Attachments = new List <IDocument>
                    {
                        new Document("TestSubject attachment subject", "txt", new byte[3])
                        {
                            Guid = "attachmentGuid"
                        }
                    },
                    DeliveryTime    = DateTime.Today.AddDays(3),
                    PrimaryDocument = { Guid = "primaryDocumentGuid" },
                    PrintDetails    = printDetails,
                    PrintIfUnread   = new PrintIfUnread(deadline, printDetails)
                };

                var expectedDto =
                    new message
                {
                    Item      = sender.Id,
                    recipient = new messagerecipient
                    {
                        Item = new nameandaddress
                        {
                            fullname     = "Ola Nordmann",
                            postalcode   = "0001",
                            city         = "Oslo",
                            addressline1 = "Biskop Gunnerus Gate 14"
                        },
                        ItemElementName = ItemChoiceType1.nameandaddress,
                        printdetails    = DomainUtility.GetPrintDetailsDataTransferObject()
                    },
                    primarydocument = new document
                    {
                        subject  = "PrimaryDocument subject",
                        filetype = "txt",
                        uuid     = "primaryDocumentGuid",
                        authenticationlevelSpecified = true,
                        sensitivitylevelSpecified    = true
                    },
                    attachment = new[]
                    {
                        new document
                        {
                            subject  = "TestSubject attachment subject",
                            filetype = "txt",
                            uuid     = "attachmentGuid",
                            sensitivitylevelSpecified    = true,
                            authenticationlevelSpecified = true
                        }
                    },
                    deliverytime          = DateTime.Today.AddDays(3),
                    deliverytimeSpecified = true,
                    printifunread         = new printifunread
                    {
                        printifunreadafter = deadline,
                        printdetails       = DomainUtility.GetPrintDetailsDataTransferObject()
                    }
                };

                //Act
                var actualDto = SendDataTransferObjectConverter.ToDataTransferObject(source);

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }