public async Task GivenGetAllAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockChannelService
            .Setup(_ => _.GetAllAsync())
            .ReturnsAsync(It.IsAny <IEnumerable <Channel> >())
            .Verifiable();

            // Act
            var result = await channelController.GetAllAsync();

            // Assert
            mockChannelService.VerifyAll();
            Assert.That(result, Is.InstanceOf <OkObjectResult>());
            Assert.That((result as OkObjectResult).StatusCode, Is.EqualTo((int)HttpStatusCode.OK));
        }
        internal async Task GivenGetAllAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockChannelService
            .Setup(_ => _.GetAllAsync())
            .ReturnsAsync(It.IsAny <IEnumerable <Channel> >())
            .Verifiable();

            // Act
            var result = await channelController.GetAllAsync();

            // Assert
            mockChannelService.VerifyAll();
            Assert.IsType <OkObjectResult>(result);
            Assert.Equal((int)HttpStatusCode.OK, (result as OkObjectResult).StatusCode);
        }
Beispiel #3
0
        public async Task GivenGetAllAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockChannelService
            .Setup(_ => _.GetAllAsync())
            .ReturnsAsync(It.IsAny <IEnumerable <Channel> >())
            .Verifiable();

            // Act
            var result = await channelController.GetAllAsync();

            // Assert
            mockChannelService.VerifyAll();
            result.Should().NotBeNull().And.BeOfType <OkObjectResult>();
            (result as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK);
        }