public async Task When_GetGameDataAndStoreInLocalDb_is_called_should_create_Puzzle_db_file_in_location_provided() { IPuzzleWebApiService puzzleWebApiService = new FakePuzzleWebApiService(); IGameDataService gameDataService = new GameDataService(puzzleWebApiService,null); string path = ApplicationData.Current.TemporaryFolder.Path; Task resultTask = gameDataService.GetGameDataAndStoreInLocalDb(ApplicationData.Current.TemporaryFolder.Path); await resultTask; bool fileExists = await FileExistInStorageLocation(path, "Puzzle.db"); Assert.IsTrue(fileExists); }
public async Task When_GetPuzzleById_is_called_on_the_Repository_Should_return_the_puzzle_with_said_id() { string path = ApplicationData.Current.TemporaryFolder.Path; IPuzzleWebApiService puzzleWebApiService = new FakePuzzleWebApiService(); IGameDataService gameDataService = new GameDataService(puzzleWebApiService,null); Task resultTask = gameDataService.GetGameDataAndStoreInLocalDb(ApplicationData.Current.TemporaryFolder.Path); await resultTask; IPuzzleRepository puzzleRepository = new PuzzleRepository(); puzzleRepository.AddPuzzleRepositoryPath(ApplicationData.Current.TemporaryFolder.Path); var result = puzzleRepository.GetPuzzleWithId(1, "Abdul"); Assert.AreEqual("Confectioner", result.FirstOrDefault().Key); }