public void ToDomain_WhenCalled_ReturnsPostingLine() { IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock); IPostingLine result = sut.ToDomain(accountingMock.Object); Assert.That(result, Is.TypeOf <PostingLine>()); }
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); }
public void ToDomain_WhenCalled_AssertContactAccountCollectionWasCalledOnAccounting() { IApplyPostingLineCommand sut = CreateSut(out Mock <IAccounting> accountingMock); sut.ToDomain(accountingMock.Object); accountingMock.Verify(m => m.ContactAccountCollection, Times.Once); }
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); }
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)); }
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); }
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); }
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)); }
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)); }
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())); }
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)); }
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)); }
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)); }
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)); }
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)); }
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 }