public void Post_Test() { // Arrange var mockService = new Mock <IBranchService>(); var controller = new BranchController(mockService.Object); // Act IHttpActionResult actionResult = controller.Post(new BranchModel { Id = 10, Name = "Branch1" }, 1); var createdResult = actionResult as OkNegotiatedContentResult <int>; // Assert Assert.IsNotNull(createdResult); //Assert.AreEqual("DefaultApi", createdResult.RouteName); Assert.IsTrue(createdResult.Content >= 0); }