Get() public method

public Get ( int user_id, int item_id, ICollection indexes ) : double
user_id int
item_id int
indexes ICollection
return double
コード例 #1
0
        public void TestAddRating()
        {
            var ratings = new StaticByteRatings(7);
            ratings.Add(1, 4, 3);
            Assert.AreEqual(1, ratings.Count);
            ratings.Add(1, 8, 2);
            Assert.AreEqual(2, ratings.Count);
            ratings.Add(2, 4, 2);
            ratings.Add(2, 2, 6);
            ratings.Add(2, 5, 4);
            ratings.Add(3, 7, 2);
            ratings.Add(6, 3, 3);

            Assert.AreEqual(4, ratings.Get(2, 5));
            Assert.AreEqual(3, ratings.Get(1, 4));
            Assert.AreEqual(3, ratings.Get(6, 3));
            Assert.AreEqual(7, ratings.Count);
        }
コード例 #2
0
        public void TestGet()
        {
            var ratings = new StaticByteRatings(8);
            ratings.Add(1, 4, 3);
            ratings.Add(1, 8, 2);
            ratings.Add(2, 4, 2);
            ratings.Add(2, 2, 6);
            ratings.Add(2, 5, 4);
            ratings.Add(3, 4, 2);
            ratings.Add(3, 3, 3);
            ratings.Add(6, 3, 3);

            // test Get
            Assert.AreEqual(2, ratings.Get(2, 4));
            Assert.AreEqual(3, ratings.Get(3, 3));
            Assert.AreEqual(3, ratings.Get(6, 3));

            // test index[,]
            Assert.AreEqual(3, ratings[1, 4]);
            Assert.AreEqual(2, ratings[1, 8]);
            Assert.AreEqual(6, ratings[2, 2]);
        }