public void GetAllOrdersShouldReturnCollection() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); int id = 1; Order o = new Order(id); o.Address = "Golosyivskiy, 120B"; o.Location = "50.386157, 30.484798"; o.DateAndTime = DateTime.Now.AddHours(1); o.PassengerId = 3; List <Order> orders = new List <Order>() { o }; Expect.Call(sut.GetAllOrders()).Return(orders).Repeat.Times(3); repo.ReplayAll(); Assert.NotNull(sut.GetAllOrders()); Assert.NotEmpty(sut.GetAllOrders()); Assert.IsType <List <Order> >(sut.GetAllOrders()); repo.VerifyAll(); }
public void GetAllOrdersShouldReturnNull() { MockRepository repo = new MockRepository(); ITaxiDataRepository sut = repo.StrictMock <Linq2SqlTaxiDataRepository>(); List <Order> orders = null; Expect.Call(sut.GetAllOrders()).Return(orders); repo.ReplayAll(); Assert.Null(sut.GetAllOrders()); repo.VerifyAll(); }