Ejemplo n.º 1
0
        public void Put_Test()
        {
            // Arrange
            var mockService = new Mock <IBranchService>();
            var controller  = new BranchController(mockService.Object);

            // Act
            IHttpActionResult actionResult = controller.Put(new BranchModel {
                Id = 10, Name = "Branch1"
            }, 1);
            var contentResult = actionResult as NegotiatedContentResult <BranchModel>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.AreEqual(HttpStatusCode.Accepted, contentResult.StatusCode);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual(10, contentResult.Content.Id);
        }