public async Task QueryResult_ReturnsNotFound_IfCommandResultNull()
        {
            // Arrange
            var command = new TestQuery();
            var invoker = A.Fake <IQueryInvoker>();

            A.CallTo(() => invoker.Invoke(command, null))
            .Returns(Task.FromResult((ExecutionResponse)null));

            var controller = new TestQueryController(invoker);

            // Act
            var result = await controller.CallQuery(command);

            // Assert
            result.Should().BeOfType <NotFoundResult>();
        }
        public async Task QueryResult_ReturnsStatusCodeOnly_IfStatusCodeHasNoBody(int statusCode)
        {
            // Arrange
            var command           = new TestQuery();
            var actionOutcome     = new ActionOutcome("foobar", statusCode, true);
            var executionResponse = ExecutionResponse.Create("the result", actionOutcome, null);
            var invoker           = A.Fake <IQueryInvoker>();

            A.CallTo(() => invoker.Invoke(command, null))
            .Returns(executionResponse);

            var controller = new TestQueryController(invoker);

            // Act
            var result = await controller.CallQuery(command);

            // Assert
            result.Should().BeOfType <StatusCodeResult>().Which.StatusCode.Should().Be(statusCode);
        }
        public async Task QueryResult_ReturnsStatusCodeAndContent()
        {
            // Arrange
            var command           = new TestQuery();
            var executionResponse = ExecutionResponse.Create("the result", ActionOutcome.Conflict, null);
            var invoker           = A.Fake <IQueryInvoker>();

            A.CallTo(() => invoker.Invoke(command, null))
            .Returns(executionResponse);

            var controller = new TestQueryController(invoker);

            // Act
            var result = (ObjectResult)await controller.CallQuery(command);

            // Assert
            result.StatusCode.Should().Be(409);
            result.Value.Should().Be("the result");
        }