Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }