public void testGetPreferencesForItem() { IPreferenceArray prefs = new GenericUserPreferenceArray(2); long sampleUserID = 4; prefs.SetUserID(0, sampleUserID); long sampleItemID = 11; prefs.SetItemID(0, sampleItemID); prefs.SetUserID(1, sampleUserID); long sampleItemID2 = 22; prefs.SetItemID(1, sampleItemID2); FastByIDMap <IPreferenceArray> delegatePreferences = new FastByIDMap <IPreferenceArray>(); delegatePreferences.Put(sampleUserID, prefs); PlusAnonymousConcurrentUserDataModel instance = getTestableWithDelegateData(10, delegatePreferences); long anonymousUserID = instance.TakeAvailableUser().Value; IPreferenceArray tempPrefs = new GenericUserPreferenceArray(2); tempPrefs.SetUserID(0, anonymousUserID); tempPrefs.SetItemID(0, sampleItemID); tempPrefs.SetUserID(1, anonymousUserID); long sampleItemID3 = 33; tempPrefs.SetItemID(1, sampleItemID3); instance.SetTempPrefs(tempPrefs, anonymousUserID); Assert.AreEqual(sampleUserID, instance.GetPreferencesForItem(sampleItemID).Get(0).GetUserID()); Assert.AreEqual(2, instance.GetPreferencesForItem(sampleItemID).Length()); Assert.AreEqual(1, instance.GetPreferencesForItem(sampleItemID2).Length()); Assert.AreEqual(1, instance.GetPreferencesForItem(sampleItemID3).Length()); Assert.AreEqual(2, instance.GetNumUsersWithPreferenceFor(sampleItemID)); Assert.AreEqual(1, instance.GetNumUsersWithPreferenceFor(sampleItemID, sampleItemID2)); Assert.AreEqual(1, instance.GetNumUsersWithPreferenceFor(sampleItemID, sampleItemID3)); }