public void TestAll() { bool test = true; using (RaceContext context = new RaceContext()) { var list1 = context.Cars.ToArray(); using (CarCRUD CarCRUD = new CarCRUD(new RaceContext())) { var list2 = CarCRUD.All().ToArray(); if (list1.Length != list2.Length) { test = false; Assert.True(test); } Boolean equalTest = false; foreach (Cars car in list1) { foreach (Cars car2 in list2) { if (car.Id == car2.Id) { equalTest = true; } } if (equalTest != true) { Assert.True(equalTest); } } Assert.True(true); } } }
public void All_returns_collection_of_cars() { var cc = new CarCRUD(context); ICollection <Car> expected = context.Car.ToArray(); ICollection <Car> actual = cc.All(); Assert.Equal(expected, actual); }