Beispiel #1
0
        public void PostControllerIndexReturnsView_ExpectedSuccess()
        {
            // Arrange
            var posts = GetPosts();
            var _mock = new Mock <IPostLogic>();

            _mock.Setup(x => x.GetAllPosts()).ReturnsAsync(posts);
            var controllerUnderTest = new PostController(_context, _mock.Object);

            // Act
            var result = controllerUnderTest.DriverIndex(1);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(typeof(Task <IActionResult>), result.GetType());
        }