예제 #1
0
            public void Converts_manifest_with_availability_successfully()
            {
                //Arrange
                const string organizationNumberSender = "12345678902";

                var source = new Manifest(new Sender(organizationNumberSender), DomainUtility.GetPortalDocument(),
                                          new List <Signer>
                {
                    new Signer(new PersonalIdentificationNumber("01043100358"), new NotificationsUsingLookup()),
                    new Signer(new PersonalIdentificationNumber("01043100319"), new NotificationsUsingLookup())
                })
                {
                    Availability = DomainUtility.GetAvailability()
                };

                var expected = new portalsignaturejobmanifest
                {
                    sender = new sender {
                        organizationnumber = organizationNumberSender
                    },
                    document = new portaldocument
                    {
                        title       = source.Document.Title,
                        description = source.Document.Message,
                        href        = source.Document.FileName,
                        mime        = source.Document.MimeType
                    },
                    signers = new[]
                    {
                        new portalsigner
                        {
                            Item  = ((PersonalIdentificationNumber)source.Signers.ElementAt(0).Identifier).Value,
                            Item1 = new notificationsusinglookup {
                                email = new enabled()
                            },
                            onbehalfof          = signingonbehalfof.SELF,
                            onbehalfofSpecified = true,
                        },
                        new portalsigner
                        {
                            Item  = ((PersonalIdentificationNumber)source.Signers.ElementAt(1).Identifier).Value,
                            Item1 = new notificationsusinglookup {
                                email = new enabled()
                            },
                            onbehalfof          = signingonbehalfof.SELF,
                            onbehalfofSpecified = true,
                        }
                    },
                    availability = new availability
                    {
                        activationtime            = source.Availability.Activation.Value,
                        availableseconds          = source.Availability.AvailableSeconds.Value,
                        activationtimeSpecified   = true,
                        availablesecondsSpecified = true
                    }
                };

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

                //Assert
                var comparator = new Comparator();
                IEnumerable <IDifference> differences;

                comparator.AreEqual(expected, result, out differences);
                Assert.Empty(differences);
            }