public void PostMethodSetsLocationHeader() { // Arrange var controller = new ItemsController(_itemRepository.Object); // Act IHttpActionResult actionResult = controller.Post(new BudgetItem { Id = 25, Notes= "Office Lunch", BudgetLocationId = 2, BudgetSubCategoryId = 2, Amount = 15, DateOccured = DateTime.Now, IsExpense = true, IsFixed = false} ); var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult<BudgetItem>; // Assert Assert.IsNotNull(createdResult); Assert.AreEqual("DefaultApi", createdResult.RouteName); Assert.AreEqual(25, createdResult.RouteValues["id"]); }