public void GetEmployeeShouldGetOneEntity() { var emploeeController = new EmployeeWCFController(new MemeoryEmployeeBoService()); var item = emploeeController.GetEmployee(1); Assert.NotNull(item); Assert.IsType <Employee>(item); }
public void GetEmployeeReturnsCorrectItemFromRepository() { // Arrange var product = new Employee { EmployeeID = 1, Title = "SD" }; var controller = new EmployeeWCFController(new MemeoryEmployeeBoService()); // Act var result = controller.GetEmployee(1); // Assert Assert.Equal(product.EmployeeID, result.EmployeeID); }
public void PutEmployeeUpdatesRepository() { //Arrange var controller = new EmployeeWCFController(new MemeoryEmployeeBoService()); var item = new Employee { EmployeeID = 1, Title = "PM" }; // Act controller.PutEmployee(item); var existEmployee = controller.GetEmployee(1); // Assert Assert.NotNull(existEmployee); Assert.Same(item, existEmployee); }
public void GetProductThrowsWhenRepositoryReturnsNull() { var controller = new EmployeeWCFController(new MemeoryEmployeeBoService()); Assert.Throws <HttpResponseException>(() => controller.GetEmployee(222)); }