Beispiel #1
0
        [Test()] public void TestAddRating()
        {
            var ratings = new StaticRatings(7);

            ratings.Add(1, 4, 0.3);
            Assert.AreEqual(1, ratings.Count);
            ratings.Add(1, 8, 0.2);
            Assert.AreEqual(2, ratings.Count);
            ratings.Add(2, 4, 0.2);
            ratings.Add(2, 2, 0.6);
            ratings.Add(2, 5, 0.4);
            ratings.Add(3, 7, 0.2);
            ratings.Add(6, 3, 0.3);

            Assert.AreEqual(0.4, ratings.Get(2, 5));
            Assert.AreEqual(0.3, ratings.Get(1, 4));
            Assert.AreEqual(0.3, ratings.Get(6, 3));
            Assert.AreEqual(7, ratings.Count);
        }
Beispiel #2
0
        [Test()] public void TestGet()
        {
            var ratings = new StaticRatings(8);

            ratings.Add(1, 4, 0.3);
            ratings.Add(1, 8, 0.2);
            ratings.Add(2, 4, 0.2);
            ratings.Add(2, 2, 0.6);
            ratings.Add(2, 5, 0.4);
            ratings.Add(3, 4, 0.2);
            ratings.Add(3, 3, 0.3);
            ratings.Add(6, 3, 0.3);

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

            // test index[,]
            Assert.AreEqual(0.3, ratings[1, 4]);
            Assert.AreEqual(0.2, ratings[1, 8]);
            Assert.AreEqual(0.6, ratings[2, 2]);
        }