Пример #1
0
        public void FromModel_PrimaryContactModel_UpdatesContact()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .Build();

            PrimaryContactModel inputPrimaryContactModel = new PrimaryContactModel
            {
                FirstName       = Guid.NewGuid().ToString(),
                LastName        = Guid.NewGuid().ToString(),
                EmailAddress    = Guid.NewGuid().ToString(),
                TelephoneNumber = Guid.NewGuid().ToString()
            };

            var actualContact = contact.FromModel(inputPrimaryContactModel);

            Contact expectedContact = ContactBuilder
                                      .Create()
                                      .WithFirstName(inputPrimaryContactModel.FirstName)
                                      .WithLastName(inputPrimaryContactModel.LastName)
                                      .WithEmail(inputPrimaryContactModel.EmailAddress)
                                      .WithPhone(inputPrimaryContactModel.TelephoneNumber)
                                      .Build();

            actualContact.Should().BeEquivalentTo(expectedContact);
        }
Пример #2
0
        public void IsSupplierSectionComplete_HasPrimaryContact_ReturnsTrue()
        {
            var order = OrderBuilder
                        .Create()
                        .WithSupplierContact(ContactBuilder.Create().Build())
                        .Build();

            order.IsSupplierSectionComplete().Should().BeTrue();
        }
Пример #3
0
        public void FromModel_NullPrimaryContactModelModel_ThrowsException()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .Build();

            Assert.Throws <ArgumentNullException>(() =>
            {
                contact.FromModel(null);
            });
        }
Пример #4
0
        public void ToModel_Contact_ReturnsPrimaryContactModel()
        {
            Contact contact = ContactBuilder
                              .Create()
                              .WithFirstName(Guid.NewGuid().ToString())
                              .WithLastName(Guid.NewGuid().ToString())
                              .WithEmail(Guid.NewGuid().ToString())
                              .WithPhone(Guid.NewGuid().ToString())
                              .Build();

            var actual = contact.ToModel();

            PrimaryContactModel expected = new PrimaryContactModel
            {
                FirstName       = contact.FirstName,
                LastName        = contact.LastName,
                EmailAddress    = contact.Email,
                TelephoneNumber = contact.Phone
            };

            actual.Should().BeEquivalentTo(expected);
        }