Exemplo n.º 1
0
        public void ToDomain_WhenCalled_ReturnsCompany()
        {
            ICompanyCommand sut = CreateSut();

            ICompany result = sut.ToDomain();

            Assert.That(result, Is.TypeOf <Company>());
        }
Exemplo n.º 2
0
        public void ToDomain_WhenCommandDoesNotHaveSecondaryPhone_ReturnsContactWithoutSecondaryPhone()
        {
            ICompanyCommand sut = CreateSut(hasSecondaryPhone: false);

            string result = sut.ToDomain().SecondaryPhone;

            Assert.That(result, Is.Null);
        }
Exemplo n.º 3
0
        public void ToDomain_WhenCommandDoesNotHaveHomePage_ReturnsContactWithoutHomePage()
        {
            ICompanyCommand sut = CreateSut(hasHomePage: false);

            string result = sut.ToDomain().HomePage;

            Assert.That(result, Is.Null);
        }
Exemplo n.º 4
0
        public void ToDomain_WhenCommandDoesNotHaveAddressCommand_ReturnsContactWithEmptyAddress()
        {
            ICompanyCommand sut = CreateSut(hasAddressCommand: false);

            IAddress result = sut.ToDomain().Address;

            Assert.That(result.DisplayAddress, Is.EqualTo(string.Empty));
        }
Exemplo n.º 5
0
        public void ToDomain_WhenCommandHasAddressCommandWhichAreNotEmpty_AssertToDomainWasCalledOnAddressCommand()
        {
            Mock <IAddressCommand> addressCommandMock = CreateAddressCommandMock();
            ICompanyCommand        sut = CreateSut(addressCommand: addressCommandMock.Object);

            sut.ToDomain();

            addressCommandMock.Verify(m => m.ToDomain(), Times.Once());
        }
Exemplo n.º 6
0
        public void ToDomain_WhenCommandDoesNotHaveAddressCommand_AssertToDomainWasNotCalledOnAddressCommand()
        {
            Mock <IAddressCommand> addressCommandMock = CreateAddressCommandMock();
            ICompanyCommand        sut = CreateSut(hasAddressCommand: false, addressCommand: addressCommandMock.Object);

            sut.ToDomain();

            addressCommandMock.Verify(m => m.ToDomain(), Times.Never);
        }
Exemplo n.º 7
0
        public void ToDomain_WhenCommandHasCompanyNameCommand_AssertToDomainWasCalledOnCompanyNameCommand()
        {
            Mock <ICompanyNameCommand> companyNameCommandMock = CreateCompanyNameCommandMock();
            ICompanyCommand            sut = CreateSut(companyNameCommandMock.Object);

            sut.ToDomain();

            companyNameCommandMock.Verify(m => m.ToDomain(), Times.Once());
        }
Exemplo n.º 8
0
        public void ToDomain_WhenCommandHasHomePage_ReturnsContactWithHomePageFromCommand()
        {
            string          homePage = _fixture.Create <string>();
            ICompanyCommand sut      = CreateSut(homePage: homePage);

            string result = sut.ToDomain().HomePage;

            Assert.That(result, Is.EqualTo(homePage));
        }
Exemplo n.º 9
0
        public void ToDomain_WhenCommandHasSecondaryPhone_ReturnsContactWithSecondaryPhoneFromCommand()
        {
            string          secondaryPhone = _fixture.Create <string>();
            ICompanyCommand sut            = CreateSut(secondaryPhone: secondaryPhone);

            string result = sut.ToDomain().SecondaryPhone;

            Assert.That(result, Is.EqualTo(secondaryPhone));
        }
Exemplo n.º 10
0
        public void ToDomain_WhenCommandHasAddressCommandWhichAreEmpty_ReturnsContactWithEmptyAddress()
        {
            IAddressCommand addressCommand = CreateAddressCommandMock(true).Object;
            ICompanyCommand sut            = CreateSut(addressCommand: addressCommand);

            IAddress result = sut.ToDomain().Address;

            Assert.That(result.DisplayAddress, Is.EqualTo(string.Empty));
        }
Exemplo n.º 11
0
        public void ToDomain_WhenCommandHasAddressCommandWhichAreNotEmpty_ReturnsContactWithValueFromToDomainOnAddressCommand()
        {
            IAddress        address        = _fixture.BuildAddressMock().Object;
            IAddressCommand addressCommand = CreateAddressCommandMock(address: address).Object;
            ICompanyCommand sut            = CreateSut(addressCommand: addressCommand);

            IAddress result = sut.ToDomain().Address;

            Assert.That(result, Is.EqualTo(address));
        }
Exemplo n.º 12
0
        public void ToDomain_WhenCalled_ReturnsContactWithValueFromToDomainOnNameCommand()
        {
            ICompanyName        companyName        = _fixture.BuildCompanyNameMock().Object;
            ICompanyNameCommand companyNameCommand = CreateCompanyNameCommandMock(companyName).Object;
            ICompanyCommand     sut = CreateSut(companyNameCommand);

            IName result = sut.ToDomain().Name;

            Assert.That(result, Is.EqualTo(companyName));
        }