public void Add() { var carRepositoryMock = new CarRepositoryMock(); var carsService = new CarsService(carRepositoryMock); carsService.Add(12, 1234, "anrej", "anrej", "anrej", 12); Assert.IsNotNull(carRepositoryMock.MockedCars.FirstOrDefault()); }
public void SortByYearShouldReturnSortedCarsCollection() { var sortByString = "year"; var model = (List <Car>) this.GetModel(() => this.controller.Sort(sortByString)); var result = new CarRepositoryMock().FakeCarCollection.OrderBy(m => m.Make).ToList(); Assert.AreEqual(result.First <Car>().Id, model.First <Car>().Id); Assert.AreEqual(result.First <Car>().Model, model.First <Car>().Model); Assert.AreEqual(result.Last <Car>().Make, model.Last <Car>().Make); Assert.AreEqual(result.Last <Car>().Year, model.Last <Car>().Year); }