public GetAccountingQueryHandler(IValidator validator, IAccountingRepository accountingRepository, IAccountingHelper accountingHelper) : base(validator, accountingRepository) { NullGuard.NotNull(accountingHelper, nameof(accountingHelper)); _accountingHelper = accountingHelper; }
public GetAccountingCollectionQueryHandler(IAccountingRepository accountingRepository, IAccountingHelper accountingHelper) { NullGuard.NotNull(accountingRepository, nameof(accountingRepository)) .NotNull(accountingHelper, nameof(accountingHelper)); _accountingRepository = accountingRepository; _accountingHelper = accountingHelper; }
public void ApplyLogicForPrincipal_WhenAccountingCollectionIsNull_ThrowsArgumentNullException() { IAccountingHelper sut = CreateSut(); ArgumentNullException result = Assert.Throws <ArgumentNullException>(() => sut.ApplyLogicForPrincipal((IEnumerable <IAccounting>)null)); Assert.That(result.ParamName, Is.EqualTo("accountingCollection")); }
public void ApplyLogicForPrincipal_WhenCalledWithAccountingCollection_AssertGetAccountingNumberWasCalledOnClaimResolver() { IAccountingHelper sut = CreateSut(); sut.ApplyLogicForPrincipal(_fixture.CreateMany <IAccounting>(_random.Next(5, 10)).ToList()); _claimResolverMock.Verify(m => m.GetAccountingNumber(), Times.Once); }
public void ApplyLogicForPrincipal_WhenCalledWithAccounting_AssertGetAccountingNumberWasCalledOnClaimResolver() { IAccountingHelper sut = CreateSut(); sut.ApplyLogicForPrincipal(_fixture.Create <IAccounting>()); _claimResolverMock.Verify(m => m.GetAccountingNumber(), Times.Once); }
public void ApplyLogicForPrincipal_WhenCalledWithAccounting_ReturnsAccounting() { IAccountingHelper sut = CreateSut(); IAccounting accounting = _fixture.Create <IAccounting>(); IAccounting result = sut.ApplyLogicForPrincipal(accounting); Assert.That(result, Is.EqualTo(accounting)); }
public void ApplyLogicForPrincipal_WhenCalledWithAccountingCollection_ReturnsAccountingCollection() { IAccountingHelper sut = CreateSut(); IEnumerable <IAccounting> accountingCollection = _fixture.CreateMany <IAccounting>(_random.Next(5, 10)).ToList(); IEnumerable <IAccounting> result = sut.ApplyLogicForPrincipal(accountingCollection); Assert.That(result, Is.EqualTo(accountingCollection)); }
public void ApplyLogicForPrincipal_WhenCalledWithAccounting_AssertApplyDefaultForPrincipalWasCalledOnAccounting() { int accountingNumber = _fixture.Create <int>(); IAccountingHelper sut = CreateSut(accountingNumber); Mock <IAccounting> accountingMock = _fixture.BuildAccountingMock(); sut.ApplyLogicForPrincipal(accountingMock.Object); accountingMock.Verify(m => m.ApplyDefaultForPrincipal(It.Is <int?>(value => value == accountingNumber)), Times.Once()); }
public void ApplyLogicForPrincipal_WhenCalledWithAccountingCollection_AssertApplyDefaultForPrincipalWasCalledOnEachAccounting() { int accountingNumber = _fixture.Create <int>(); IAccountingHelper sut = CreateSut(accountingNumber); IEnumerable <Mock <IAccounting> > accountingMockCollection = new List <Mock <IAccounting> > { _fixture.BuildAccountingMock(), _fixture.BuildAccountingMock(), _fixture.BuildAccountingMock() }; sut.ApplyLogicForPrincipal(accountingMockCollection.Select(accountingMock => accountingMock.Object).ToList()); foreach (Mock <IAccounting> accountingMock in accountingMockCollection) { accountingMock.Verify(m => m.ApplyDefaultForPrincipal(It.Is <int?>(value => value == accountingNumber)), Times.Once()); } }