public void GetAllByMakeId_ShouldReturnNeededItems() { int id = 2; var items = new List <Vehicle>() { new Vehicle() { MakeId = 3, ModelId = id, BodyTypeId = id }, new Vehicle() { Id = 1, MakeId = id, ModelId = 2, BodyTypeId = 2 }, new Vehicle() { Id = 2, MakeId = id, ModelId = 1, BodyTypeId = 1 }, new Vehicle() { MakeId = 10, ModelId = 2, BodyTypeId = 2 }, }.AsQueryable(); var repositoryMock = new Mock <IInternalDbRepository <Vehicle> >(); repositoryMock.Setup(x => x.All()).Returns(() => items); var service = new VehiclesService(repositoryMock.Object); var response = service.GetAllByMakeId(id).ToList(); Assert.AreEqual(response.Count, 2); Assert.AreEqual(response[0].Id, 1); Assert.AreEqual(response[1].Id, 2); repositoryMock.VerifyAll(); }