public void GetCarShouldReturnNull() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); int id = 10; Car carExpected = null; Expect.Call(sut.GetCar(id)).Return(carExpected); repo.ReplayAll(); Assert.Null(sut.GetCar(id)); repo.VerifyAll(); }
public void GetCarShouldReturnCar() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); int id = 1; Car carExpected = new Car(id); carExpected.Brand = "Volkswagen"; carExpected.Model = "Polo Sedan"; carExpected.Number = "AI1234AT"; Expect.Call(sut.GetCar(id)).Return(carExpected); repo.ReplayAll(); Assert.True(carExpected.Equals(sut.GetCar(id))); repo.VerifyAll(); }