private void InvalidFileGeneric(FavoriteType type) { IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication(); using (IsolatedStorageFileStream favoritesFile = appStorage.OpenFile(fileNames[type], System.IO.FileMode.Create)) { byte[] randomData = Guid.NewGuid().ToByteArray(); favoritesFile.Write(randomData, 0, randomData.Length); } IAppDataModel appDataModel2 = new AppDataModel(); try { List<FavoriteRouteAndStop> favorites = appDataModel2.GetFavorites(type); Assert.Fail("Expected GetFavorites to throw an exception with bogus data"); // TODO this used to catch the exception and just return an empty list, which is what the test used to assert as well. // I'm not sure which behavior is correct -- I just updated the test to match the current behavior. } catch (Exception) { } }
private void DeleteFavoriteGeneric(FavoriteType type) { AddAndGetFavoriteGeneric(type); appDataModel.DeleteFavorite(fakeData.FAVORITE[type], type); List<FavoriteRouteAndStop> favorites = appDataModel.GetFavorites(type); Assert.Equals(favorites.Count, 0); IAppDataModel appDataModel2 = new AppDataModel(); favorites = appDataModel2.GetFavorites(type); Assert.Equals(favorites.Count, 0); }