Exemplo n.º 1
0
        public void DeleteEmployeeReturnsResponseMessageWithNoContentStatusCode()
        {
            var controller = new EmployeeWCFController(new MemeoryEmployeeBoService());

            var employee = new Employee {
                EmployeeID = 111
            };
            var result = controller.DeleteEmployee(employee);

            Assert.IsType <HttpResponseMessage>(result);
            Assert.Equal(HttpStatusCode.NoContent, result.StatusCode);
        }
Exemplo n.º 2
0
        public void DeleteEmployeeCallsRepositoryRemove()
        {
            int removedId  = 123;
            var mockobject = new Mock <IEmployeeBoService>();

            mockobject.Setup(e => e.DelEmployee(It.Is <Employee>(i => i.EmployeeID == removedId))).Returns(true);
            var serviceclient = mockobject.Object;
            var controller    = new EmployeeWCFController(serviceclient);
            var employee      = new Employee {
                EmployeeID = removedId
            };

            controller.DeleteEmployee(employee);

            Assert.Equal(123, removedId);
        }