Esempio n. 1
0
        public void TestGetOne()
        {
            //Arrange
            TestsController controller = new TestsController();

            //Act
            IActionResult  p      = controller.Get(3);
            OkObjectResult result = p as OkObjectResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatusCode, 200);
        }
Esempio n. 2
0
        public void TestGetOneIDNotFound()
        {
            //Arrange
            TestsController controller = new TestsController();

            //Act
            IActionResult    p      = controller.Get(50);
            StatusCodeResult result = p as StatusCodeResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(result.StatusCode, 404);
        }
Esempio n. 3
0
        public void TestGetAll()
        {
            //Arrange
            List <Test>     tests      = new List <Test>();
            TestsController controller = new TestsController();
            bool            check;

            //Act
            tests = controller.Get();
            check = tests.Count > 0;

            //Assert
            Assert.AreEqual(check, true);
        }