Example #1
0
        public void Post_Returns_New_Id_When_Created()
        {
            //Arrange
            int expectedId = int.MaxValue;
            var vendor     = new Vendor {
            };

            mockService.Setup(m => m.CreateVendor(
                                  It.IsAny <Vendor>()
                                  )).Returns(expectedId);

            //Act
            ActionResult actionResult = controller.Post(vendor);

            //Assert

            OkObjectResult result = Assert.IsType <OkObjectResult>(actionResult);

            int actualResult = Assert.IsType <int>(result.Value);

            Assert.Equal(expectedId, actualResult);
        }