public void GetAllDriversInCarsShouldReturnCollection() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); int id = 1; DriverInCar dIC = new DriverInCar(id); dIC.CarId = 3; dIC.DriverId = 3; dIC.Address = "Akademika Glushkova 12A"; dIC.Location = "50.374211, 30.462582"; List <DriverInCar> driversInCars = new List <DriverInCar>() { dIC }; Expect.Call(sut.GetAllDriversInCars()).Return(driversInCars).Repeat.Times(3); repo.ReplayAll(); Assert.NotNull(sut.GetAllDriversInCars()); Assert.NotEmpty(sut.GetAllDriversInCars()); Assert.IsType <List <DriverInCar> >(sut.GetAllDriversInCars()); repo.VerifyAll(); }
public void GetAllDriversInCarsShouldReturnNull() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); List <DriverInCar> driversInCars = null; Expect.Call(sut.GetAllDriversInCars()).Return(driversInCars); repo.ReplayAll(); Assert.Null(sut.GetAllDriversInCars()); repo.VerifyAll(); }