示例#1
0
        public void MaxAggregator_Merge()
        {
            var maxAggr1 = new MaxAggregator("test");
            var maxAggr2 = new MaxAggregator("test");
            Func <object, string, object> getVal = (r, f) => {
                return(r);
            };

            maxAggr1.Push(5, getVal);
            maxAggr1.Push(2, getVal);
            maxAggr2.Push(3, getVal);

            maxAggr1.Merge(maxAggr2);
            Assert.Equal(5, maxAggr1.Value);
            maxAggr2.Merge(maxAggr1);
            Assert.Equal(5, maxAggr2.Value);

            // datetime values
            var maxAggr3 = new MaxAggregator("test");

            maxAggr3.Push(new DateTime(1983, 5, 6), getVal);
            maxAggr3.Push(new DateTime(2000, 1, 1), getVal);
            Assert.Equal(2000, ((DateTime)maxAggr3.Value).Year);

            var maxAggr4 = new MaxAggregator("test");

            maxAggr4.Push(new DateTime(2010, 2, 2), getVal);
            maxAggr3.Merge(maxAggr4);
            Assert.Equal(2010, ((DateTime)maxAggr3.Value).Year);
        }
示例#2
0
        public void MaxAggregator()
        {
            var maxAggr = new MaxAggregator("test");
            Func <object, string, object> getVal = (r, f) => {
                Assert.Equal("test", f);
                return(r);
            };

            maxAggr.Push(5, getVal);
            Assert.Equal(5, maxAggr.Value);
            maxAggr.Push(3, getVal);
            Assert.Equal(5, maxAggr.Value);
            maxAggr.Push(7, getVal);
            Assert.Equal(7, maxAggr.Value);
        }
示例#3
0
 public VolumeMeter(ProgressBar progressBar)
 {
     this.progressBar = progressBar;
     this.aggregator  = new MaxAggregator(1000, SetVolumeMeter);
 }
示例#4
0
 protected override void InitializeSystemUnderTests()
 {
     SystemUnderTests = new MaxAggregator();
 }
示例#5
0
 public Normalize()
 {
     this.aggregator = new MaxAggregator(1000, SetVolumeMeter);
 }