public void testItemID()
 {
     IPreferenceArray prefs = new GenericItemPreferenceArray(3);
     Assert.AreEqual(3, prefs.Length());
     prefs.SetUserID(0, 1L);
     prefs.SetUserID(1, 2L);
     prefs.SetUserID(2, 3L);
     Assert.AreEqual(1L, prefs.GetUserID(0));
     Assert.AreEqual(2L, prefs.GetUserID(1));
     Assert.AreEqual(3L, prefs.GetUserID(2));
 }
        public void testSort()
        {
            IPreferenceArray prefs = new GenericItemPreferenceArray(3);

            prefs.Set(0, new GenericPreference(3L, 1L, 5.0f));
            prefs.Set(1, new GenericPreference(1L, 1L, 5.0f));
            prefs.Set(2, new GenericPreference(2L, 1L, 5.0f));
            prefs.SortByUser();
            Assert.AreEqual(1L, prefs.GetUserID(0));
            Assert.AreEqual(2L, prefs.GetUserID(1));
            Assert.AreEqual(3L, prefs.GetUserID(2));
        }
        public void testItemID()
        {
            IPreferenceArray prefs = new GenericItemPreferenceArray(3);

            Assert.AreEqual(3, prefs.Length());
            prefs.SetUserID(0, 1L);
            prefs.SetUserID(1, 2L);
            prefs.SetUserID(2, 3L);
            Assert.AreEqual(1L, prefs.GetUserID(0));
            Assert.AreEqual(2L, prefs.GetUserID(1));
            Assert.AreEqual(3L, prefs.GetUserID(2));
        }
 public void testClone()
 {
     GenericItemPreferenceArray prefs = new GenericItemPreferenceArray(3);
     prefs.Set(0, new GenericPreference(3L, 1L, 5.0f));
     prefs.Set(1, new GenericPreference(1L, 1L, 4.0f));
     prefs.Set(2, new GenericPreference(2L, 1L, 3.0f));
     prefs = (GenericItemPreferenceArray)prefs.Clone();
     Assert.AreEqual(3L, prefs.GetUserID(0));
     Assert.AreEqual(1L, prefs.GetItemID(1));
     Assert.AreEqual(3.0f, prefs.GetValue(2), EPSILON);
 }
        public void testClone()
        {
            GenericItemPreferenceArray prefs = new GenericItemPreferenceArray(3);

            prefs.Set(0, new GenericPreference(3L, 1L, 5.0f));
            prefs.Set(1, new GenericPreference(1L, 1L, 4.0f));
            prefs.Set(2, new GenericPreference(2L, 1L, 3.0f));
            prefs = (GenericItemPreferenceArray)prefs.Clone();
            Assert.AreEqual(3L, prefs.GetUserID(0));
            Assert.AreEqual(1L, prefs.GetItemID(1));
            Assert.AreEqual(3.0f, prefs.GetValue(2), EPSILON);
        }
Ejemplo n.º 6
0
 public long GetUserID()
 {
     return(arr.GetUserID(i));
 }
 public void testSort()
 {
     IPreferenceArray prefs = new GenericItemPreferenceArray(3);
     prefs.Set(0, new GenericPreference(3L, 1L, 5.0f));
     prefs.Set(1, new GenericPreference(1L, 1L, 5.0f));
     prefs.Set(2, new GenericPreference(2L, 1L, 5.0f));
     prefs.SortByUser();
     Assert.AreEqual(1L, prefs.GetUserID(0));
     Assert.AreEqual(2L, prefs.GetUserID(1));
     Assert.AreEqual(3L, prefs.GetUserID(2));
 }