Example #1
0
        public async Task ShouldListSolutionsByFilter()
        {
            var filter = new ListSolutionsFilterViewModel();
            var result = (await _solutionListController.ListByFilterAsync(filter)).Result as ObjectResult;

            result.StatusCode.Should().Be((int)HttpStatusCode.OK);
            (result.Value as ListSolutionsResult).Solutions.Should().BeEquivalentTo(_solutions);
            _mockMediator.Verify(
                m => m.Send(
                    It.Is <ListSolutionsQuery>(q => q.Data.IsSameOrEqualTo(filter)),
                    It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ShouldListSolutionsByFilter()
        {
            var filter = new ListSolutionsFilterViewModel();
            var result = (await solutionListController.ListByFilterAsync(filter)).Result as ObjectResult;

            Assert.NotNull(result);
            result.StatusCode.Should().Be(StatusCodes.Status200OK);

            result.Value.Should().BeOfType <ListSolutionsResult>();
            result.Value.As <ListSolutionsResult>().Solutions.Should().BeEquivalentTo(solutions);

            mockMediator.Verify(m => m.Send(
                                    It.Is <ListSolutionsQuery>(q => q.Data.Equals(filter)),
                                    It.IsAny <CancellationToken>()));
        }
 public async Task <ActionResult <ListSolutionsResult> > ListByFilterAsync(ListSolutionsFilterViewModel filter)
 {
     return(Ok(new ListSolutionsResult(await mediator.Send(new ListSolutionsQuery(filter)))));
 }