public void TestGetOneNonExisting() { DepartmentsService service = CreateService(); Department department = service.Get(3); // The service must return default(Department) == null when the department is not found. Assert.Null(department); }
public void TestGetOneExisting() { DepartmentsService service = CreateService(); Department department1 = service.Get(1); // The service must find this item. Assert.NotNull(department1); // Checks if the service is returning the proper item. Assert.Equal(1, department1.Id); Assert.Equal("Ecology Department", department1.Name); Assert.Equal("1865 Reserve St Campbellford, ON K0L 1L0", department1.Address); // Second check to verify if the service is correctly considering the Id on search. Department department2 = service.Get(2); Assert.NotNull(department2); Assert.Equal(2, department2.Id); Assert.Equal("Construction Department", department2.Name); Assert.Equal("2635 Hammarskjold Dr Burnaby, BC V5B 3C9", department2.Address); }
public ActionResult <List <Departments> > Get() => _departmentsService.Get();