Exemplo n.º 1
0
        public void Validate_WhenCommonRepositoryIsNull_ThrowsArgumentNullException()
        {
            ILetterHeadCommand sut = CreateSut();

            ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.Validate(_validatorMockContext.ValidatorMock.Object, null));

            Assert.That(result.ParamName, Is.EqualTo("commonRepository"));
        }
        public void ToDomain_WhenCalled_ReturnsLetterHead()
        {
            ILetterHeadCommand sut = CreateSut();

            ILetterHead result = sut.ToDomain();

            Assert.That(result, Is.TypeOf <LetterHead>());
        }
Exemplo n.º 3
0
        public void Validate_WhenCalled_ReturnsValidator()
        {
            ILetterHeadCommand sut = CreateSut();

            IValidator result = sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object);

            Assert.That(result, Is.EqualTo(_validatorMockContext.ValidatorMock.Object));
        }
        public void ToDomain_WhenCalled_ReturnsLetterHeadWithLine4FromCommand()
        {
            string             line4 = _fixture.Create <string>();
            ILetterHeadCommand sut   = CreateSut(line4: line4);

            ILetterHead result = sut.ToDomain();

            Assert.That(result.Line4, Is.EqualTo(line4));
        }
        public void ToDomain_WhenCalled_ReturnsLetterHeadWithNameFromCommand()
        {
            string             name = _fixture.Create <string>();
            ILetterHeadCommand sut  = CreateSut(name: name);

            ILetterHead result = sut.ToDomain();

            Assert.That(result.Name, Is.EqualTo(name));
        }
        public void ToDomain_WhenCalled_ReturnsLetterHeadWithNumberFromCommand()
        {
            int number             = _fixture.Create <int>();
            ILetterHeadCommand sut = CreateSut(number);

            ILetterHead result = sut.ToDomain();

            Assert.That(result.Number, Is.EqualTo(number));
        }
        public void ToDomain_WhenCalled_ReturnsLetterHeadWithCompanyIdentificationNumberFromCommand()
        {
            string             companyIdentificationNumber = _fixture.Create <string>();
            ILetterHeadCommand sut = CreateSut(companyIdentificationNumber: companyIdentificationNumber);

            ILetterHead result = sut.ToDomain();

            Assert.That(result.CompanyIdentificationNumber, Is.EqualTo(companyIdentificationNumber));
        }
Exemplo n.º 8
0
        public void Validate_WhenCalled_AssertShouldNotBeNullOrWhiteSpaceWasCalledOnStringValidatorForName()
        {
            string             name = _fixture.Create <string>();
            ILetterHeadCommand sut  = CreateSut(name);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object);

            _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldNotBeNullOrWhiteSpace(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, name) == 0),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.Compare(field, "Name", false) == 0)),
                                                             Times.Once());
        }
Exemplo n.º 9
0
        public void Validate_WhenCalled_AssertShouldHaveMaxLengthWasCalledOnStringValidatorForCompanyIdentificationNumber()
        {
            string             companyIdentificationNumber = _fixture.Create <string>();
            ILetterHeadCommand sut = CreateSut(companyIdentificationNumber: companyIdentificationNumber);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object);

            _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldHaveMaxLength(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, companyIdentificationNumber) == 0),
                                                                 It.Is <int>(value => value == 32),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.Compare(field, "CompanyIdentificationNumber", false) == 0),
                                                                 It.Is <bool>(value => value == true)),
                                                             Times.Once());
        }
Exemplo n.º 10
0
        public void Validate_WhenCalled_AssertShouldHaveMaxLengthWasCalledOnStringValidatorForLine7()
        {
            string             line7 = _fixture.Create <string>();
            ILetterHeadCommand sut   = CreateSut(line7: line7);

            sut.Validate(_validatorMockContext.ValidatorMock.Object, _commonRepositoryMock.Object);

            _validatorMockContext.StringValidatorMock.Verify(m => m.ShouldHaveMaxLength(
                                                                 It.Is <string>(value => string.CompareOrdinal(value, line7) == 0),
                                                                 It.Is <int>(value => value == 64),
                                                                 It.Is <Type>(type => type == sut.GetType()),
                                                                 It.Is <string>(field => string.Compare(field, "Line7", false) == 0),
                                                                 It.Is <bool>(value => value == true)),
                                                             Times.Once());
        }