public async Task GivenGetByIdAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockVideoService
            .Setup(_ => _.GetByIdAsync(It.IsAny <Guid>()))
            .ReturnsAsync(It.IsAny <Video>())
            .Verifiable();

            // Act
            var result = await videoController.GetByIdAsync(It.IsAny <Guid>());

            // Assert
            mockVideoService.VerifyAll();
            Assert.That(result, Is.InstanceOf <OkObjectResult>());
            Assert.That((result as OkObjectResult).StatusCode, Is.EqualTo((int)HttpStatusCode.OK));
        }
Exemple #2
0
        public async Task GivenGetByIdAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockVideoService
            .Setup(_ => _.GetByIdAsync(It.IsAny <Guid>()))
            .ReturnsAsync(It.IsAny <Video>())
            .Verifiable();

            // Act
            var result = await videoController.GetByIdAsync(It.IsAny <Guid>());

            // Assert
            mockVideoService.VerifyAll();
            result.Should().NotBeNull().And.BeOfType <OkObjectResult>();
            (result as OkObjectResult).StatusCode.Should().Be((int)HttpStatusCode.OK);
        }
        internal async Task GivenGetByIdAsyncWhenDataExistThenReturnsData()
        {
            // Arrange
            mockVideoService
            .Setup(_ => _.GetByIdAsync(It.IsAny <Guid>()))
            .ReturnsAsync(It.IsAny <Video>())
            .Verifiable();

            // Act
            var result = await videoController.GetByIdAsync(It.IsAny <Guid>());

            // Assert
            mockVideoService.VerifyAll();
            Assert.IsType <OkObjectResult>(result);
            Assert.Equal((int)HttpStatusCode.OK, (result as OkObjectResult).StatusCode);
        }