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

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

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

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

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

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

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