Exemple #1
0
        public async Task Status_ReturnsCorrectResult_AndCallsCorrectMethod(
            [Frozen] ISqsConsumerService consumerServiceMock,
            ConsumerController controllerUnderTest)
        {
            var sqsStatus = new SqsStatus();

            consumerServiceMock.GetStatusAsync().Returns(sqsStatus);

            var result = await controllerUnderTest.Status();

            var asObjectResult = (ObjectResult)result;
            var asObjectValue  = (SqsStatus)asObjectResult.Value;

            Assert.Equal(200, asObjectResult.StatusCode);
            Assert.Equal(sqsStatus, asObjectValue);
            await consumerServiceMock.Received().GetStatusAsync();
        }
        public async Task <IActionResult> Status()
        {
            var status = await _sqsConsumerService.GetStatusAsync();

            return(StatusCode((int)HttpStatusCode.OK, status));
        }