Exemplo n.º 1
0
        public void GetTodoSuccess()
        {
            //Arrange
            Todo.TodoElements.Clear();

            var testTodoData  = new ToDoElement(1, "test", "testContent");
            var testTodoData2 = new ToDoElement(2, "test1", "testContent");

            Todo.TodoElements.Add(testTodoData);
            Todo.TodoElements.Add(testTodoData2);

            var expectedResult = new TodoList();

            expectedResult.TodoElements = new List <ToDoElement>()
            {
                testTodoData, testTodoData2
            };

            var expectedResultData = Json(expectedResult);

            //Act
            var receivedData = _controller.GetAllTodo();

            //Assert
            Assert.Equal(expectedResultData.Value, receivedData.Value);
        }
Exemplo n.º 2
0
        public void GetAllTodo_Positive()
        {
            // Arrange
            todoController         = new TodoController(todoMockDal);
            todoController.Request = new HttpRequestMessage();
            todoController.Request.SetConfiguration(new HttpConfiguration());

            //Act
            var result = todoController.GetAllTodo();

            //Assert
            Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
            //Assert.AreEqual(2, result.Content.);
        }