예제 #1
0
        public void CalcHistogram_CornerCaseEmptyList()
        {
            IStatsService         statsService = new StatsService();
            Dictionary <int, int> histogram    = statsService.GetHistogram(new double[] { });

            Assert.Empty(histogram);
        }
예제 #2
0
        public void CalcStandardDeviation()
        {
            IStatsService statsService      = new StatsService();
            double        standardDeviation = statsService.CalcStandardDeviation(new double[] { 3, 7, 7, 19 });

            Assert.Equal(6, standardDeviation);
        }
예제 #3
0
        public void CalArithmeticMean_DoubleInputValues_Success()
        {
            IStatsService statsService = new StatsService();
            double        mean         = statsService.CalcArithmeticMean(new double[] { 1.5, 1.5, 1.5 });

            Assert.Equal(1.5, mean);
        }
예제 #4
0
        public void CalcHistogram()
        {
            IStatsService         statsService = new StatsService();
            Dictionary <int, int> histogram    = statsService.GetHistogram(new double[] { 3, 70, 110, 6, 110, 110.5 });

            Assert.Equal(3, histogram.Count);
            Assert.Equal(2, histogram[0]);
            Assert.Equal(3, histogram[11]);
        }
예제 #5
0
        public void CalcStandardDeviation_CornerCaseOneItem()
        {
            IStatsService statsService = new StatsService();

            Assert.Throws <ArgumentException>(() => statsService.CalcStandardDeviation(new double[] { 10 }));
        }
예제 #6
0
        public void CalArithmeticMean_CornerCase_ZeroValue()
        {
            IStatsService statsService = new StatsService();

            Assert.Equal(0, statsService.CalcArithmeticMean(new double[] { 0 }));
        }
예제 #7
0
        public void CalArithmeticMean_EmptyList_Exception()
        {
            IStatsService statsService = new StatsService();

            Assert.Throws <ArgumentException>(() => statsService.CalcArithmeticMean(new double[] { }));
        }
예제 #8
0
 public void InitService()
 {
     IStatsService statsService = new StatsService();
 }