public async Task BudgetAccountAsync_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsActionResultWhereResultIsOkObjectResult()
        {
            Controller sut = CreateSut();

            ActionResult <BudgetAccountModel> result = await sut.BudgetAccountAsync(_fixture.Create <int>(), _fixture.Create <string>());

            Assert.That(result.Result, Is.TypeOf <OkObjectResult>());
        }
        public async Task BudgetAccountAsync_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <BudgetAccountModel> result = await sut.BudgetAccountAsync(_fixture.Create <int>(), _fixture.Create <string>());

            Assert.That(result, Is.Not.Null);
        }
Beispiel #3
0
        public async Task AccountAsync_WhenAccountWasReturnedFromQueryBus_ReturnsOkObjectResultWhereValueIsNotNull()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.AccountAsync(_fixture.Create <int>(), _fixture.Create <string>())).Result;

            Assert.That(result.Value, Is.Not.Null);
        }
Beispiel #4
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsPostingJournalResult_ReturnsOkObjectResultWhereValueIsNotNull()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.ApplyPostingJournalAsync(_fixture.Create <int>(), CreateApplyPostingLineCollectionModel())).Result;

            Assert.That(result.Value, Is.Not.Null);
        }
        public async Task BudgetAccountAsync_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsOkObjectResultWhereValueIsBudgetAccountModel()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.BudgetAccountAsync(_fixture.Create <int>(), _fixture.Create <string>())).Result;

            Assert.That(result.Value, Is.TypeOf <BudgetAccountModel>());
        }
Beispiel #6
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsPostingJournalResult_ReturnsOkObjectResultWhereValueIsApplyPostingJournalResultModel()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel())).Result;

            Assert.That(result.Value, Is.TypeOf <ApplyPostingJournalResultModel>());
        }
        public async Task AccountingsAsync_WhenCalled_ReturnsOkObjectResult()
        {
            Controller sut = CreateSut();

            ActionResult <IEnumerable <AccountingModel> > result = await sut.AccountingsAsync();

            Assert.That(result.Result, Is.TypeOf <OkObjectResult>());
        }
Beispiel #8
0
        public async Task CreditorsAsync_WhenCalled_ReturnsActionResultWhereResultIsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <ContactAccountCollectionModel> result = await sut.CreditorsAsync(_fixture.Create <int>());

            Assert.That(result.Result, Is.Not.Null);
        }
Beispiel #9
0
        public async Task ApplyPostingJournalAsync_WhenApplyPostingLineCollectionModelIsValid_AssertPublishAsyncWasCalledOnCommandBusWithApplyPostingJournalCommand()
        {
            Controller sut = CreateSut();

            await sut.ApplyPostingJournalAsync(_fixture.Create <int>(), CreateApplyPostingLineCollectionModel());

            _commandBusMock.Verify(m => m.PublishAsync <IApplyPostingJournalCommand, IPostingJournalResult>(It.IsNotNull <IApplyPostingJournalCommand>()), Times.Once);
        }
Beispiel #10
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsPostingJournalResult_ReturnsActionResultWhereResultIsOkObjectResult()
        {
            Controller sut = CreateSut();

            ActionResult <ApplyPostingJournalResultModel> result = await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel());

            Assert.That(result.Result, Is.TypeOf <OkObjectResult>());
        }
Beispiel #11
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsPostingJournalResult_ReturnsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <ApplyPostingJournalResultModel> result = await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel());

            Assert.That(result, Is.Not.Null);
        }
Beispiel #12
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsNull_ReturnsOkObjectResultWhereValueIsNotNull()
        {
            Controller sut = CreateSut(false);

            OkObjectResult result = (OkObjectResult)(await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel())).Result;

            Assert.That(result.Value, Is.Not.Null);
        }
Beispiel #13
0
        public async Task ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsValid_AssertPublishAsyncWasCalledOnCommandBusWithApplyPostingJournalCommandWherePostingLineCollectionIsNotNull()
        {
            Controller sut = CreateSut();

            await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel());

            _commandBusMock.Verify(m => m.PublishAsync <IApplyPostingJournalCommand, IPostingJournalResult>(It.Is <IApplyPostingJournalCommand>(command => command.PostingLineCollection != null)), Times.Once);
        }
Beispiel #14
0
        public async Task ApplyPostingJournalAsync_WhenPublishAsyncForApplyPostingJournalCommandReturnsPostingJournalResult_ReturnsActionResultWhereResultIsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <ApplyPostingJournalResultModel> result = await sut.ApplyPostingJournalAsync(_fixture.Create <int>(), CreateApplyPostingLineCollectionModel());

            Assert.That(result.Result, Is.Not.Null);
        }
Beispiel #15
0
        public async Task BudgetAccountsAsync_WhenCalled_ReturnsActionResultWhereResultIsOkObjectResult()
        {
            Controller sut = CreateSut();

            ActionResult <BudgetAccountCollectionModel> result = await sut.BudgetAccountsAsync(_fixture.Create <int>());

            Assert.That(result.Result, Is.TypeOf <OkObjectResult>());
        }
Beispiel #16
0
        public async Task PostingLinesAsync_WhenCalled_ReturnsOkObjectResultWhereValueIsNotNull()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.PostingLinesAsync(_fixture.Create <int>())).Result;

            Assert.That(result.Value, Is.Not.Null);
        }
        public async Task AccountingAsync_WhenCalled_ReturnsOkObjectResult()
        {
            Controller sut = CreateSut();

            ActionResult <AccountingModel> result = await sut.AccountingAsync(_fixture.Create <int>());

            Assert.That(result.Result, Is.TypeOf <OkObjectResult>());
        }
Beispiel #18
0
        public async Task BudgetAccountsAsync_WhenCalled_ReturnsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <BudgetAccountCollectionModel> result = await sut.BudgetAccountsAsync(_fixture.Create <int>());

            Assert.That(result, Is.Not.Null);
        }
Beispiel #19
0
        public async Task BudgetAccountsAsync_WhenCalled_ReturnsOkObjectResultWhereValueIsBudgetAccountCollectionModel()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.BudgetAccountsAsync(_fixture.Create <int>())).Result;

            Assert.That(result.Value, Is.TypeOf <BudgetAccountCollectionModel>());
        }
Beispiel #20
0
        public async Task PostingLinesAsync_WhenCalled_ReturnsOkObjectResultWhereValueIsPostingLineCollectionModel()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)(await sut.PostingLinesAsync(_fixture.Create <int>())).Result;

            Assert.That(result.Value, Is.TypeOf <PostingLineCollectionModel>());
        }
Beispiel #21
0
        public async Task PostingLinesAsync_WhenCalled_ReturnsNotNull()
        {
            Controller sut = CreateSut();

            ActionResult <PostingLineCollectionModel> result = await sut.PostingLinesAsync(_fixture.Create <int>());

            Assert.That(result, Is.Not.Null);
        }
        public async Task AccountingsAsync_WhenCalled_AssertQueryAsyncWasCalledOnQueryBus()
        {
            Controller sut = CreateSut();

            await sut.AccountingsAsync();

            _queryBusMock.Verify(m => m.QueryAsync <EmptyQuery, IEnumerable <IAccounting> >(It.IsNotNull <EmptyQuery>()), Times.Once);
        }
Beispiel #23
0
        public void ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsInvalid_ThrowsIntranetValidationExceptionWhereErrorCodeIsEqualToValueCannotBeNull()
        {
            Controller sut = CreateSut(modelIsValid: false);

            IntranetValidationException result = Assert.ThrowsAsync <IntranetValidationException>(async() => await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel()));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.SubmittedMessageInvalid));
        }
Beispiel #24
0
        public async Task BudgetAccountsAsync_WhenCalledWithoutStatusDate_AssertQueryAsyncWasCalledOnQueryBus()
        {
            Controller sut = CreateSut();

            int accountingNumber = _fixture.Create <int>();
            await sut.BudgetAccountsAsync(accountingNumber);

            _queryBusMock.Verify(m => m.QueryAsync <IGetBudgetAccountCollectionQuery, IBudgetAccountCollection>(It.Is <IGetBudgetAccountCollectionQuery>(value => value.AccountingNumber == accountingNumber && value.StatusDate == DateTime.Today)), Times.Once);
        }
Beispiel #25
0
        public async Task PostingLinesAsync_WhenCalledWithoutNumberOfPostingLines_AssertQueryAsyncWasCalledOnQueryBus()
        {
            Controller sut = CreateSut();

            int accountingNumber = _fixture.Create <int>();
            await sut.PostingLinesAsync(accountingNumber);

            _queryBusMock.Verify(m => m.QueryAsync <IGetPostingLineCollectionQuery, IPostingLineCollection>(It.Is <IGetPostingLineCollectionQuery>(value => value.AccountingNumber == accountingNumber && value.StatusDate == DateTime.Today && value.NumberOfPostingLines == 25)), Times.Once);
        }
Beispiel #26
0
        public async Task ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsValid_AssertPublishAsyncWasCalledOnCommandBusWithApplyPostingJournalCommandWhereAccountingNumberIsEqualToAccountNumberFromApplyPostingJournalModel()
        {
            Controller sut = CreateSut();

            int accountingNumber = _fixture.Create <int>();
            await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel(accountingNumber));

            _commandBusMock.Verify(m => m.PublishAsync <IApplyPostingJournalCommand, IPostingJournalResult>(It.Is <IApplyPostingJournalCommand>(command => command.AccountingNumber == accountingNumber)), Times.Once);
        }
Beispiel #27
0
        public void ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsNull_ThrowsIntranetValidationExceptionWhereValidatingFieldIsEqualToApplyPostingJournal()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.ThrowsAsync <IntranetValidationException>(async() => await sut.ApplyPostingJournalAsync(null));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ValidatingField, Is.EqualTo("applyPostingJournal"));
        }
Beispiel #28
0
        public void ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsNull_ThrowsIntranetValidationExceptionWhereErrorCodeIsEqualToValueCannotBeNull()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.ThrowsAsync <IntranetValidationException>(async() => await sut.ApplyPostingJournalAsync(null));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueCannotBeNull));
        }
        public void BudgetAccountAsync_WhenAccountNumberIsEmpty_ThrowsIntranetValidationExceptionWhereErrorCodeIsEqualToValueCannotBeNullOrWhiteSpace()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.ThrowsAsync <IntranetValidationException>(async() => await sut.BudgetAccountAsync(_fixture.Create <int>(), string.Empty));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueCannotBeNullOrWhiteSpace));
        }
Beispiel #30
0
        public void ApplyPostingJournalAsync_WhenApplyPostingJournalModelIsInvalid_ThrowsIntranetValidationExceptionWhereValidatingFieldIsNull()
        {
            Controller sut = CreateSut(modelIsValid: false);

            IntranetValidationException result = Assert.ThrowsAsync <IntranetValidationException>(async() => await sut.ApplyPostingJournalAsync(CreateApplyPostingJournalModel()));

            Assert.That(result, Is.Not.Null);
            Assert.That(result.ValidatingField, Is.Null);
        }