public void Setup() { _farms = new List <FarmEntity> { new FarmEntity { AmountOfAnimals = 15, DelitingDate = null, Id = 1, IsDelete = false, Name = Faker.CompanyFaker.Name(), OwnerName = Faker.NameFaker.MaleName(), Cost = 1500 }, new FarmEntity { AmountOfAnimals = 20, DelitingDate = null, Id = 2, IsDelete = false, Name = Faker.CompanyFaker.Name(), OwnerName = Faker.NameFaker.MaleName(), Cost = 400 }, new FarmEntity { AmountOfAnimals = 1, DelitingDate = null, Id = 3, IsDelete = false, Name = Faker.CompanyFaker.Name(), OwnerName = Faker.NameFaker.MaleName(), Cost = 100 }, new FarmEntity { AmountOfAnimals = 100, DelitingDate = null, Id = 4, IsDelete = false, Name = Faker.CompanyFaker.Name(), OwnerName = Faker.NameFaker.MaleName(), Cost = 500 }, new FarmEntity { AmountOfAnimals = 50, DelitingDate = null, Id = 5, IsDelete = false, Name = Faker.CompanyFaker.Name(), OwnerName = Faker.NameFaker.MaleName(), Cost = 500 } }; var mockedDbContext = new Mock <FarmContext>(); _db = mockedDbContext.Object; var dbset = new FakeDbSet <FarmEntity>(_farms); mockedDbContext.Setup(x => x.FarmEntities) .Returns(() => dbset); _unitOfWork = new UnitOfWork(_db); _farmRepository = new FarmRepository(_db); _farmService = new FarmService(_unitOfWork); _farmController = new FarmController(_farmService); }