示例#1
0
        public void CanDifference()
        {
            var x = new ResultCube();

            x.Initialize(new Dictionary <string, Type> {
                { "gwah", typeof(string) }, { "wwahh", typeof(int) }
            });
            var y = new ResultCube();

            y.Initialize(new Dictionary <string, Type> {
                { "gwah", typeof(string) }, { "wwahh", typeof(int) }
            });

            x.AddRow(new object[] { "woooh", 6 }, 77.6);
            y.AddRow(new object[] { "woooh", 6 }, 77.4);

            var d = x.Difference(y);

            Assert.Equal(0.2, d.GetAllRows().First().Value, 10);

            var z = new ResultCube();

            z.Initialize(new Dictionary <string, Type> {
                { "gwah", typeof(bool) }, { "wwahh", typeof(int) }
            });
            Assert.Throws <Exception>(() => x.Difference(z));
            Assert.Throws <Exception>(() => x.QuickDifference(z));

            y.AddRow(new object[] { "woooh", 7 }, 77.4);
            Assert.Throws <Exception>(() => x.QuickDifference(y));
        }