public void GetParts_GivenThreeCarParts_ShouldReturnCarParts() { //---------------Set up test pack------------------- var part1 = new CarPartBuilder().WithNewId().BuildSaved(); var part2 = new CarPartBuilder().WithNewId().BuildSaved(); var part3 = new CarPartBuilder().WithNewId().BuildSaved(); var userRepository = new CarPartRepository(); var cars = new List <CarPart> { part1, part2, part3 }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var result = userRepository.GetCarPart(); //---------------Test Result ----------------------- Assert.AreEqual(result.Count, cars.Count); }
public void GetCarParts_GivenOneCarPart_ShouldReturnCarPart() { //---------------Set up test pack------------------- var car = new CarPartBuilder().WithNewId().BuildSaved(); var userRepository = new CarPartRepository(); var cars = new List <CarPart> { car }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var result = userRepository.GetCarPart(); //---------------Test Result ----------------------- Assert.AreEqual(result.Count, cars.Count); var actual = cars.First(); Assert.AreSame(car, actual); }