Exemplo n.º 1
0
        public void SendLetterWithPrintIfUnread()
        {
            var recipient = new RecipientByNameAndAddress(
                fullName: "Ola Nordmann",
                addressLine1: "Prinsensveien 123",
                postalCode: "0460",
                city: "Oslo"
                );

            var printDetails =
                new PrintDetails(
                    printRecipient: new PrintRecipient(
                        "Ola Nordmann",
                        new NorwegianAddress("0460", "Oslo", "Prinsensveien 123")),
                    printReturnRecipient: new PrintReturnRecipient(
                        "Kari Nordmann",
                        new NorwegianAddress("0400", "Oslo", "Akers Àle 2"))
                    );

            var primaryDocument = new Document(subject: "document subject", fileType: "pdf", path: @"c:\...\document.pdf");

            var messageWithPrintIfUnread = new Message(sender, recipient, primaryDocument)
            {
                PrintDetails  = printDetails,
                DeliveryTime  = DateTime.Now.AddDays(3),
                PrintIfUnread = new PrintIfUnread(DateTime.Now.AddDays(6), printDetails)
            };

            var result = client.SendMessage(messageWithPrintIfUnread);
        }
Exemplo n.º 2
0
        public void SendOneLetterViaNameAndAddress()
        {
            var recipient = new RecipientByNameAndAddress(
                fullName: "Ola Nordmann",
                addressLine1: "Prinsensveien 123",
                postalCode: "0460",
                city: "Oslo"
                );

            var primaryDocument = new Document(subject: "document subject", fileType: "pdf", path: @"c:\...\document.pdf");

            var message = new Message(sender, recipient, primaryDocument);
            var result  = client.SendMessage(message);
        }
        public IMessage GetMessage()
        {
            lock (_lock)
            {
                if (_message != null)
                {
                    return(_message);
                }

                var primaryDocument = new Document("document subject", "txt", GetDocumentBytes());
                var digitalRecipientWithFallbackPrint = new RecipientByNameAndAddress("Ola Nordmann", "0460",
                                                                                      "Oslo", "Collettsgate 68");
                _message = new Message(new Sender(1010), digitalRecipientWithFallbackPrint, primaryDocument);
            }

            return(_message);
        }
Exemplo n.º 4
0
            public void SimpleConstructor()
            {
                //Arrange
                const string fullName     = "Ola Nordmann";
                const string addressLine1 = "Biskop Gunnerus Gate 14";
                const string postalCode   = "0001";
                const string city         = "Oslo";

                var recipientByNameAndAddress = new RecipientByNameAndAddress(fullName, addressLine1, postalCode, city);

                //Act

                //Assert
                Assert.Equal(fullName, recipientByNameAndAddress.FullName);
                Assert.Equal(postalCode, recipientByNameAndAddress.PostalCode);
                Assert.Equal(city, recipientByNameAndAddress.City);
                Assert.Equal(addressLine1, recipientByNameAndAddress.AddressLine1);
            }
Exemplo n.º 5
0
            public void RecipientByNameAndAddress()
            {
                //Arrange
                var birthDate = DateTime.Now;

                var source = new RecipientByNameAndAddress("Ola Nordmann", "Biskop Gunnerus Gate 14", "0001", "Oslo")
                {
                    AddressLine2 = "Etasje 15",
                    BirthDate    = birthDate,
                    PhoneNumber  = "123456789",
                    Email        = "*****@*****.**"
                };

                var expectedDto = new messagerecipient
                {
                    ItemElementName = ItemChoiceType1.nameandaddress,
                    Item            = new nameandaddress
                    {
                        fullname           = source.FullName,
                        addressline1       = source.AddressLine1,
                        addressline2       = source.AddressLine2,
                        postalcode         = source.PostalCode,
                        city               = source.City,
                        birthdate          = birthDate,
                        birthdateSpecified = true,
                        phonenumber        = source.PhoneNumber,
                        emailaddress       = source.Email
                    }
                };

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

                //Assert
                Comparator.AssertEqual(expectedDto, actualDto);
            }
        private static identification IdentificationDataTranferObjectFromIdentificationByNameAndAddress(RecipientByNameAndAddress recipientByNameAndAddress)
        {
            var identification = new identification
            {
                ItemElementName = ItemChoiceType.nameandaddress,
                Item            = new nameandaddress
                {
                    fullname     = recipientByNameAndAddress.FullName,
                    addressline1 = recipientByNameAndAddress.AddressLine1,
                    addressline2 = recipientByNameAndAddress.AddressLine2,
                    postalcode   = recipientByNameAndAddress.PostalCode,
                    city         = recipientByNameAndAddress.City,
                    emailaddress = recipientByNameAndAddress.Email,
                    phonenumber  = recipientByNameAndAddress.PhoneNumber
                }
            };

            if (recipientByNameAndAddress.BirthDate.HasValue)
            {
                var nameandaddress = (nameandaddress)identification.Item;
                nameandaddress.birthdate          = recipientByNameAndAddress.BirthDate.Value;
                nameandaddress.birthdateSpecified = true;
            }

            return(identification);
        }