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>()); }
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 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 PostingLinesAsync_WhenCalled_ReturnsActionResultWhereResultIsOkObjectResult() { Controller sut = CreateSut(); ActionResult <PostingLineCollectionModel> result = await sut.PostingLinesAsync(_fixture.Create <int>()); Assert.That(result.Result, Is.TypeOf <OkObjectResult>()); }
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); }
public async Task PostingLinesAsync_WhenCalledWithStatusDate_AssertQueryAsyncWasCalledOnQueryBus() { Controller sut = CreateSut(); int accountingNumber = _fixture.Create <int>(); DateTime statusDate = DateTime.Now.AddDays(_random.Next(1, 365) * -1); await sut.PostingLinesAsync(accountingNumber, statusDate); _queryBusMock.Verify(m => m.QueryAsync <IGetPostingLineCollectionQuery, IPostingLineCollection>(It.Is <IGetPostingLineCollectionQuery>(value => value.AccountingNumber == accountingNumber && value.StatusDate == statusDate.Date && value.NumberOfPostingLines > 0)), Times.Once); }
public async Task PostingLinesAsync_WhenCalled_ReturnsOkObjectResultWhereValueIsPostingLineCollectionModelContainingPostingLines() { IList <IPostingLine> postingLines = _fixture.CreateMany <IPostingLine>(_random.Next(5, 10)).ToList(); IPostingLineCollection postingLineCollection = _fixture.BuildPostingLineCollectionMock(postingLineCollection: postingLines).Object; Controller sut = CreateSut(postingLineCollection); OkObjectResult result = (OkObjectResult)(await sut.PostingLinesAsync(_fixture.Create <int>())).Result; PostingLineCollectionModel postingLineCollectionModel = (PostingLineCollectionModel)result.Value; Assert.That(postingLineCollectionModel, Is.Not.Null); Assert.That(postingLineCollectionModel.Count, Is.EqualTo(postingLines.Count)); Assert.That(postingLineCollectionModel.All(postingLineModel => postingLines.SingleOrDefault(postingLine => postingLineModel.Identifier == postingLine.Identifier) != null), Is.True); }