Пример #1
0
        public void TestGetAll()
        {
            this.Setup();
            var context2 = CreateContext(nameDB);

            var controller = new BlogController(context2);
            var result     = controller.GetAll().Result;

            Assert.AreEqual(5, result.Value.Count());
        }
        public void Test1_GetAll()
        {
            // Arrange
            var controller = new BlogController(_context);

            // Act
            var result = getListResult(controller.GetAll());

            // Assert
            Assert.Equal("Text1", result[0].Text);
        }
Пример #3
0
        public void Test1_GetAll()
        {
            // Arrange
            var controller = new BlogController(_context);

            // Act
            IActionResult actionResult = controller.GetAll();
            var           objectResult = Assert.IsType <OkObjectResult>(actionResult);
            List <Post>   result       = objectResult.Value as List <Post>;

            // Assert
            Assert.Equal("Text1", result[0].Text);
        }