コード例 #1
0
        public void Calculate_Any_ShouldNotCreateEmptyGroups()
        {
            var numbers       = new[] { 10d };
            var unitUnderTest = new FrequencyDistribution(10);

            var distribution = unitUnderTest.Calculate(numbers);

            Assert.AreEqual(1, distribution.Keys.Count);
        }
コード例 #2
0
        public void Calculate_MinusNumbers_ShouldApportionCorrectly()
        {
            var numbers       = new[] { -10d };
            var unitUnderTest = new FrequencyDistribution(10);

            var distribution = unitUnderTest.Calculate(numbers);

            Assert.AreEqual(1, distribution[new Tuple <double, double>(-10d, 0d)]);
        }
コード例 #3
0
        public void Calculate_MultipleOccurences_ShouldApportionCorrectly()
        {
            var numbers       = new[] { 9.9, 0, 1 };
            var unitUnderTest = new FrequencyDistribution(10);

            var distribution = unitUnderTest.Calculate(numbers);

            Assert.AreEqual(3, distribution[new Tuple <double, double>(0d, 10d)]);
        }
コード例 #4
0
        public void Calculate_HighDecimal_ShouldNotRoundUp()
        {
            var numbers       = new[] { 9.9d };
            var unitUnderTest = new FrequencyDistribution(10);

            var distribution = unitUnderTest.Calculate(numbers);

            Assert.AreEqual(1, distribution[new Tuple <double, double>(0d, 10d)]);
        }
コード例 #5
0
        public void Calculate_BandingOfTwo_ShouldApportionCorrectly()
        {
            var numbers       = new[] { -1d, 0d, 1d, 2d, 3d };
            var unitUnderTest = new FrequencyDistribution(2);

            var distribution = unitUnderTest.Calculate(numbers);

            Assert.AreEqual(1, distribution[new Tuple <double, double>(-2d, 0d)]);
            Assert.AreEqual(2, distribution[new Tuple <double, double>(0d, 2d)]);
            Assert.AreEqual(2, distribution[new Tuple <double, double>(2d, 4d)]);
        }