コード例 #1
0
        /// <summary>
        /// Posts the employee returns created status code.
        /// </summary>
        public void PostEmployeeReturnsCreatedStatusCode()
        {
            var controller = new EmployeeWCFController(new MemeoryEmployeeBoService());
            SetupControllerForTests(controller);

            var result = controller.PostEmployee(new Employee { EmployeeID = 1 });
            Assert.Equal(HttpStatusCode.Created, result.StatusCode);
        }
コード例 #2
0
        /// <summary>
        /// Posts the employee returns the correct location in response message.
        /// </summary>
        public void PostEmployeeReturnsTheCorrectLocationInResponseMessage()
        {
            var controller = new EmployeeWCFController(new MemeoryEmployeeBoService());
            SetupControllerForTests(controller);

            var result = controller.PostEmployee(new Employee { EmployeeID = 111 });
            Assert.Equal("http://localhost/api/employee/111", result.Headers.Location.ToString());
            Assert.Equal(HttpStatusCode.Created, result.StatusCode);

        }