public void GetNumberOfRowsTest() { SqliteStorage storage = _storage; Assert.True(_storage.CreateTables()); List <UserPreference> preferences = new List <UserPreference>(); preferences.Add(new UserPreference("movies", 0.0, 0.0)); preferences.Add(new UserPreference("games", 0.0, 100.0)); preferences.Add(new UserPreference("tools", 0.0, 100.0)); bool result = storage.InsertUserPreferences(preferences); Assert.True(result); Assert.True(storage.GetNumberOfRows() == preferences.Count); int numItems = preferences.Count; preferences.RemoveAt(2); result = storage.DeleteUserPreferences(preferences); Assert.True(result); Assert.True(storage.GetNumberOfRows() == (numItems - preferences.Count)); }
public void GetUserPreferenceNullTest() { SqliteStorage storage = _storage; Assert.True(_storage.CreateTables()); List <UserPreference> preferences = new List <UserPreference>(); preferences.Add(new UserPreference("movies", 0.0, 0.0)); preferences.Add(new UserPreference("games", 0.0, 100.0)); preferences.Add(new UserPreference("tools", 0.0, 100.0)); bool result = storage.InsertUserPreferences(preferences); Assert.True(result); Assert.True(storage.GetNumberOfRows() == preferences.Count); UserPreference userPreference = storage.GetUserPreference("garden"); Assert.Null(userPreference); }
public void GetUserPreferenceTest() { SqliteStorage storage = _storage; Assert.True(_storage.CreateTables()); List <UserPreference> preferences = new List <UserPreference>(); preferences.Add(new UserPreference("movies", 0.0, 0.0)); preferences.Add(new UserPreference("games", 0.0, 100.0)); preferences.Add(new UserPreference("tools", 0.0, 100.0)); bool result = storage.InsertUserPreferences(preferences); Assert.True(result); Assert.True(storage.GetNumberOfRows() == preferences.Count); UserPreference userPreference = storage.GetUserPreference("games"); Assert.NotNull(userPreference); Assert.Equal("games", userPreference._category); Assert.True(userPreference._minPrice == 0.0); Assert.True(userPreference._maxPrice == 100.0); }