public void OneTimeSetUp() { Setup.Bootstrap(); CreateCatTestData(); CatRepositoryMock = new Mock <ICatRepository>(); CatDataRepositoryMock = new Mock <ICatDataRepository>(); SettingsMock = new Mock <ISettings>(); //// Setup the cat repository //CatRepositoryMockObject.Setup(x => x.GetAll()).Returns(Task.FromResult(Cats.AsEnumerable())); //CatRepositoryMockObject.Setup(x => x.GetById(It.IsAny<Guid>())) // .Returns(Task.FromResult(Cats.FirstOrDefault())); //CatRepositoryMockObject.Setup(x => x.Delete(It.IsAny<Cat>())).Returns(Task.CompletedTask); // Setup the cat data repository CatDataRepositoryMock.Setup(x => x.LoadAsync(It.IsAny <bool>())) .Returns(Task.FromResult(Cats.AsEnumerable())); CatDataRepositoryMock.Setup(x => x.SaveAsync(It.IsAny <IEnumerable <Cat> >())).Returns(Task.CompletedTask); //CatService = new CatService(CatRepositoryMockObject.Object); CatRepository = new CatRepository(CatDataRepositoryMock.Object); CatDataRepository = new CatDataRepository(SettingsMock.Object); }
public CatRepository(ICatDataRepository dataRepository) { _dataRepository = dataRepository; _entities = new List <Cat>(); }