public void Post() { // Arrange IRepository<Employee> repository = new FileSystemRepository(new TestFileHelper()); EmployeeController controller = new EmployeeController(repository); int lengthBefore = controller.GetAllEmployees().Count(); // Act Employee e = new Employee {id = 4, name="test",age=45,sex="female"}; controller.PostEmployee(e); int lengthAfter = controller.GetAllEmployees().Count(); // Assert Assert.AreEqual(lengthBefore + 1, lengthAfter); }
public void Get() { // Arrange IRepository<Employee> repository = new FileSystemRepository(new TestFileHelper()); EmployeeController controller = new EmployeeController(repository); // Act IEnumerable<Employee> result = controller.GetAllEmployees(); // Assert Assert.IsNotNull(result); Assert.AreEqual(2, result.Count()); }