public async Task GivenGetByIdsAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockChannelService
            .Setup(_ => _.GetByIdsAsync(It.IsAny <ICollection <int> >()))
            .ReturnsAsync(It.IsAny <IEnumerable <Channel> >())
            .Verifiable();

            // Act
            var result = await channelController.GetByIdsAsync(It.IsAny <ICollection <int> >());

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

            // Act
            var result = await channelController.GetByIdsAsync(It.IsAny <ICollection <int> >());

            // Assert
            mockChannelService.VerifyAll();
            Assert.IsType <OkObjectResult>(result);
            Assert.Equal((int)HttpStatusCode.OK, (result as OkObjectResult).StatusCode);
        }
Пример #3
0
        public async Task GivenGetByIdsAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockChannelService
            .Setup(_ => _.GetByIdsAsync(It.IsAny <ICollection <int> >()))
            .ReturnsAsync(It.IsAny <IEnumerable <Channel> >())
            .Verifiable();

            // Act
            var result = await channelController.GetByIdsAsync(It.IsAny <ICollection <int> >());

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