Esempio n. 1
0
        public void ToDomain_WhenMailAddressWasNotGivenInContactAccountDataCommand_ReturnsContactAccountWhereMailAddressIsNull()
        {
            IContactAccountDataCommand sut = CreateSut(hasMailAddress: false);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.MailAddress, Is.Null);
        }
Esempio n. 2
0
        public void ToDomain_WhenCalled_ReturnsContactAccount()
        {
            IContactAccountDataCommand sut = CreateSut();

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount, Is.TypeOf <ContactAccount>());
        }
Esempio n. 3
0
        public void ToDomain_WhenSecondaryPhoneWasNotGivenInContactAccountDataCommand_ReturnsContactAccountWhereSecondaryPhoneIsNull()
        {
            IContactAccountDataCommand sut = CreateSut(hasSecondaryPhone: false);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.SecondaryPhone, Is.Null);
        }
Esempio n. 4
0
        public void ToDomain_WhenDescriptionWasNotGivenInContactAccountDataCommand_ReturnsContactAccountWhereDescriptionIsNull()
        {
            IContactAccountDataCommand sut = CreateSut(hasDescription: false);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.Description, Is.Null);
        }
Esempio n. 5
0
        public void ToDomain_WhenCalled_ReturnsContactAccountWhereAccountNumberIsEqualToAccountNumberFromContactAccountDataCommand()
        {
            string accountNumber           = _fixture.Create <string>().ToUpper();
            IContactAccountDataCommand sut = CreateSut(accountNumber: accountNumber);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.AccountNumber, Is.EqualTo(accountNumber));
        }
Esempio n. 6
0
        public void ToDomain_WhenCalled_ReturnsContactAccountWhereAccountingIsEqualToAccountingFromAccountingRepository()
        {
            IAccounting accounting         = _fixture.BuildAccountingMock().Object;
            IContactAccountDataCommand sut = CreateSut(accounting: accounting);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.Accounting, Is.EqualTo(accounting));
        }
Esempio n. 7
0
        public void ToDomain_WhenCalled_AssertGetPaymentTermAsyncWasCalledOnAccountingRepository()
        {
            int paymentTermNumber          = _fixture.Create <int>();
            IContactAccountDataCommand sut = CreateSut(paymentTermNumber: paymentTermNumber);

            sut.ToDomain(_accountingRepositoryMock.Object);

            _accountingRepositoryMock.Verify(m => m.GetPaymentTermAsync(It.Is <int>(value => value == paymentTermNumber)), Times.Once);
        }
Esempio n. 8
0
        public void ToDomain_WhenCalled_ReturnsContactAccountWherePaymentTermIsEqualToPaymentTermFromAccountingRepository()
        {
            IPaymentTerm paymentTerm       = _fixture.BuildPaymentTermMock().Object;
            IContactAccountDataCommand sut = CreateSut(paymentTerm: paymentTerm);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.PaymentTerm, Is.EqualTo(paymentTerm));
        }
Esempio n. 9
0
        public void ToDomain_WhenSecondaryPhoneWasGivenInContactAccountDataCommand_ReturnsContactAccountWhereSecondaryPhoneIsEqualToSecondaryPhoneContactAccountDataCommand()
        {
            string secondaryPhone          = _fixture.Create <string>();
            IContactAccountDataCommand sut = CreateSut(secondaryPhone: secondaryPhone);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.SecondaryPhone, Is.EqualTo(secondaryPhone));
        }
Esempio n. 10
0
        public void ToDomain_WhenPrimaryPhoneWasGivenInContactAccountDataCommand_ReturnsContactAccountWherePrimaryPhoneIsEqualToPrimaryPhoneFromContactAccountDataCommand()
        {
            string primaryPhone            = _fixture.Create <string>();
            IContactAccountDataCommand sut = CreateSut(primaryPhone: primaryPhone);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.PrimaryPhone, Is.EqualTo(primaryPhone));
        }
Esempio n. 11
0
        public void ToDomain_WhenMailAddressWasGivenInContactAccountDataCommand_ReturnsContactAccountWhereMailAddressIsEqualToMailAddressFromContactAccountDataCommand()
        {
            string mailAddress             = _fixture.Create <string>();
            IContactAccountDataCommand sut = CreateSut(mailAddress: mailAddress);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.MailAddress, Is.EqualTo(mailAddress));
        }
Esempio n. 12
0
        public void ToDomain_WhenNoteWasGivenInContactAccountDataCommand_ReturnsContactAccountWhereNoteIsEqualToNoteFromContactAccountDataCommand()
        {
            string note = _fixture.Create <string>();
            IContactAccountDataCommand sut = CreateSut(note: note);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.Note, Is.EqualTo(note));
        }
Esempio n. 13
0
        public void ToDomain_WhenDescriptionWasGivenInContactAccountDataCommand_ReturnsContactAccountWhereDescriptionIsEqualToDescriptionFromContactAccountDataCommand()
        {
            string description             = _fixture.Create <string>();
            IContactAccountDataCommand sut = CreateSut(description: description);

            IContactAccount contactAccount = sut.ToDomain(_accountingRepositoryMock.Object);

            Assert.That(contactAccount.Description, Is.EqualTo(description));
        }
Esempio n. 14
0
        public void ToDomain_WhenCalled_AssertGetAccountingAsyncWasCalledOnAccountingRepository()
        {
            int accountingNumber           = _fixture.Create <int>();
            IContactAccountDataCommand sut = CreateSut(accountingNumber);

            sut.ToDomain(_accountingRepositoryMock.Object);

            _accountingRepositoryMock.Verify(m => m.GetAccountingAsync(
                                                 It.Is <int>(value => value == accountingNumber),
                                                 It.Is <DateTime>(value => value == DateTime.Today)),
                                             Times.Once);
        }
Esempio n. 15
0
        public void ToDomain_WhenAccountingRepositoryIsNull_ThrowsArgumentNullException()
        {
            IContactAccountDataCommand sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ToDomain(null));

            Assert.That(result.ParamName, Is.EqualTo("accountingRepository"));
        }