Ejemplo n.º 1
0
        public void CreateTodoItem(int id)
        {
            var controller = new TodoController(this.unitOfWork);

            var context = new DefaultHttpContext();

            controller.ActionContext.HttpContext = context;

            var createMe = new TodoItem {
                Id = id
            };

            controller.CreateTodoItem(createMe);

            var created = controller.GetById(id) as ObjectResult;

            Assert.Equal(id, (created.Value as TodoItem).Id);

            var statusCode = context.Response.StatusCode;

            Assert.Equal(201, statusCode);
        }