コード例 #1
0
        public void TestResult()
        {
            var agg = new AggregatorAvg();

            agg.Enter(100);
            Assert.AreEqual(100d, agg.Value);
            agg.Enter(150);
            Assert.AreEqual(125d, agg.Value);
            agg.Enter(200);
            Assert.AreEqual(150d, agg.Value);
            agg.Leave(100);
            Assert.AreEqual(175d, agg.Value);
        }
コード例 #2
0
        public void TestAggregation()
        {
            var agg = new AggregatorAvg();

            Assert.AreEqual(null, agg.Value);

            agg.Enter(5);
            Assert.AreEqual(5d, agg.Value);

            agg.Enter(10);
            Assert.AreEqual(7.5d, agg.Value);

            agg.Leave(5);
            Assert.AreEqual(10d, agg.Value);
        }