コード例 #1
0
        public void TestGetScoreNoRatings()
        {
            var broadcast = new MockBroadcast(0);
            var score     = broadcast.GetScore();

            Assert.AreEqual(0D, score, Delta);
        }
コード例 #2
0
        public void TestGetScoreWithRatings([Values(0, 5, 10)] int positiveWeight, [Values(0, 5, 10)] int negativeWeight)
        {
            var positiveRating = new MockRating(RatingPolarity.Positive, positiveWeight);
            var negativeRating = new MockRating(RatingPolarity.Negative, negativeWeight);
            var broadcast      = new MockBroadcast(positiveRating, negativeRating);
            var score          = broadcast.GetScore();

            var weightSum = positiveWeight + negativeWeight;
            var expected  = weightSum > 0 ? (double)positiveWeight / weightSum : 0D;

            Assert.AreEqual(expected, score, Delta);
        }