コード例 #1
0
        public void ToDomain_WhenCalled_ReturnsPostingLine()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result, Is.TypeOf <PostingLine>());
        }
コード例 #2
0
        public void ToDomain_WhenCalledApplyPostingLineCommandHasNoBudgetAccountNumber_ReturnsPostingLineWhereBudgetAccountEqualToNull()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, hasBudgetAccountNumber: false);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.BudgetAccount, Is.Null);
        }
コード例 #3
0
        public void ToDomain_WhenCalled_AssertContactAccountCollectionWasCalledOnAccounting()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            sut.ToDomain(accountingMock.Object);

            accountingMock.Verify(m => m.ContactAccountCollection, Times.Once);
        }
コード例 #4
0
        public void ToDomain_WhenCalledApplyPostingLineCommandHasContactAccountNumber_ReturnsPostingLineWhereContactAccountNotEqualToNull()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.ContactAccount, Is.Not.Null);
        }
コード例 #5
0
        public void ToDomain_WhenCalledApplyPostingLineCommandHasNoCredit_ReturnsPostingLineWhereCreditEqualToZero()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, hasCredit: false);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Credit, Is.EqualTo(0M));
        }
コード例 #6
0
        public void ToDomain_WhenCalled_ReturnsPostingLineWhereDetailsNotEqualToNull()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Details, Is.Not.Null);
        }
コード例 #7
0
        public void ToDomain_WhenApplyPostingLineCommandHasReference_ReturnsPostingLineWhereReferenceNotEqualToNull()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Reference, Is.Not.Null);
        }
コード例 #8
0
        public void ToDomain_WhenApplyPostingLineCommandHasNoIdentifier_ReturnsPostingLineWhereIdentifierNotEqualToGuidEmpty()
        {
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Identifier, Is.Not.EqualTo(Guid.Empty));
        }
コード例 #9
0
        public void ToDomain_WhenCalled_ReturnsPostingLineWhereSortOrderEqualToSortOrderFromApplyPostingLineCommand()
        {
            int sortOrder = _fixture.Create <int>();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, sortOrder: sortOrder);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.SortOrder, Is.EqualTo(sortOrder));
        }
コード例 #10
0
        public void ToDomain_WhenCalledApplyPostingLineCommandHasContactAccountNumber_ReturnsPostingLineWhereContactAccountMatchesContactAccountNumberFromApplyPostingLineCommand()
        {
            string contactAccountNumber  = _fixture.Create <string>();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, contactAccountNumber: contactAccountNumber);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.ContactAccount.AccountNumber, Is.EqualTo(contactAccountNumber.ToUpper()));
        }
コード例 #11
0
        public void ToDomain_WhenCalledApplyPostingLineCommandHasCredit_ReturnsPostingLineWhereCreditEqualToCreditFromApplyPostingLineCommand()
        {
            decimal credit = _fixture.Create <decimal>();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, credit: credit);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Credit, Is.EqualTo(credit));
        }
コード例 #12
0
        public void ToDomain_WhenCalled_ReturnsPostingLineWhereDetailsEqualToDetailsFromApplyPostingLineCommand()
        {
            string details = _fixture.Create <string>();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, details: details);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Details, Is.EqualTo(details));
        }
コード例 #13
0
        public void ToDomain_WhenApplyPostingLineCommandHasReference_ReturnsPostingLineWhereReferenceEqualToReferenceFromApplyPostingLineCommand()
        {
            string reference             = _fixture.Create <string>();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, reference: reference);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Reference, Is.EqualTo(reference));
        }
コード例 #14
0
        public void ToDomain_WhenCalled_ReturnsPostingLineWherePostingDateEqualToPostingDateFromApplyPostingLineCommand()
        {
            DateTime postingDate         = DateTime.Today.AddDays(_random.Next(0, 30) * -1).AddMinutes(_random.Next(8 * 60, 16 * 60));
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, postingDate: postingDate);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.PostingDate, Is.EqualTo(postingDate.Date));
        }
コード例 #15
0
        public void ToDomain_WhenApplyPostingLineCommandHasIdentifier_ReturnsPostingLineWhereIdentifierEqualToIdentifierFromApplyPostingLineCommand()
        {
            Guid identifier = Guid.NewGuid();
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock, true, identifier);

            IPostingLine result = sut.ToDomain(accountingMock.Object);

            Assert.That(result.Identifier, Is.EqualTo(identifier));
        }
コード例 #16
0
        public void ToDomain_WhenAccountingIsNull_ThrowsArgumentNullException()
        {
            // ReSharper disable UnusedVariable
            IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock);
            // ReSharper restore UnusedVariable

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

            // ReSharper disable PossibleNullReferenceException
            Assert.That(result.ParamName, Is.EqualTo("accounting"));
            // ReSharper restore PossibleNullReferenceException
        }