public async Task Then_Sends_ImportStandardsCommand_And_Returns_NoContent_Result(
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] DataLoadController controller)
        {
            var controllerResult = await controller.Index() as NoContentResult;

            mockMediator.Verify(x => x.Send(It.IsAny <ImportDataCommand>(), It.IsAny <CancellationToken>()), Times.Once);
            Assert.IsNotNull(controllerResult);
            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.NoContent);
        }
Ejemplo n.º 2
0
        public async Task And_Exception_Then_Returns_Bad_Request(
            [Frozen] Mock <IMediator> mockMediator,
            [Greedy] DataLoadController controller)
        {
            mockMediator
            .Setup(mediator => mediator.Send(
                       It.IsAny <ImportDataCommand>(),
                       It.IsAny <CancellationToken>()))
            .Throws <InvalidOperationException>();

            var controllerResult = await controller.Index() as StatusCodeResult;

            controllerResult.StatusCode.Should().Be((int)HttpStatusCode.BadRequest);
        }