public async Task Status_ReturnsCorrectResult_AndCallsCorrectMethod()
        {
            var sqsStatus = new SqsStatus();

            _consumerServiceMock.Setup(x => x.GetStatusAsync())
            .ReturnsAsync(sqsStatus);

            var result = await _consumerControllerUnderTest.Status();

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

            Assert.AreEqual(200, asObjectResult.StatusCode);
            Assert.AreEqual(sqsStatus, asObjectValue);
            _consumerServiceMock.Verify(x => x.GetStatusAsync());
        }
Ejemplo n.º 2
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();
        }