Exemplo n.º 1
0
        public void Inquirer_Gets_Expected_Range(Xiles xile, int size, int toXile, int fromXile)
        {
            var data       = Helper.GetRandomDataSample(size).ToList();
            var calculator = Helper.NewInquirer <TInquirer>(data);

            var expected = Helper.CalcNthXile(data, (int)xile, toXile) - Helper.CalcNthXile(data, (int)xile, fromXile);
            var actual   = GetInterXileRangeMethod(xile).Invoke(calculator, new object[] {});

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        private static XileInfo AssertValidXile(int nTh, Xiles xile)
        {
            if (nTh < 1 || nTh > (int)xile)
            {
                var xileName = Enum.GetName(typeof(Xiles), xile);
                throw new StatisticsException(string.Format(ExceptionMessages.Invalid_Xile_Name_Format, xileName), new IndexOutOfRangeException(string.Format(ExceptionMessages.Invalid_Xile_Name_Number_Format, xileName, nTh)));
            }

            return(new XileInfo(xile, nTh));
        }
Exemplo n.º 3
0
        public void Inquirer_Gets_All_Expected(Xiles xile, int size)
        {
            var data       = Helper.GetRandomDataSample(size).ToList();
            var calculator = Helper.NewInquirer <TInquirer>(data);
            var method     = GetXileMethod(xile);

            var expected = GetXiles((int)xile, nTh => Helper.CalcNthXile(data, (int)xile, nTh)).ToList();
            var actual   = GetXiles((int)xile, nTh => (double)method.Invoke(calculator, new object[] { nTh })).ToList();

            CollectionAssert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
 public XileInfo(Xiles xile, int nthXile)
 {
     this.Xile = xile;
     this.NthXile = nthXile;
 }
Exemplo n.º 5
0
 public XileInfo(Xiles xile, int nthXile)
 {
     this.Xile    = xile;
     this.NthXile = nthXile;
 }
Exemplo n.º 6
0
        private static XileInfo AssertValidXile(int nTh, Xiles xile)
        {
            if (nTh < 1 || nTh > (int)xile)
            {
                var xileName = Enum.GetName(typeof(Xiles), xile);
                throw new StatisticsException(string.Format(ExceptionMessages.Invalid_Xile_Name_Format, xileName), new IndexOutOfRangeException(string.Format(ExceptionMessages.Invalid_Xile_Name_Number_Format, xileName, nTh)));
            }

            return new XileInfo(xile, nTh);
        }
Exemplo n.º 7
0
 private MethodInfo GetInterXileRangeMethod(Xiles xile)
 {
     return(typeof(TInquirer).GetMethod("GetInter" + Enum.GetName(typeof(Xiles), xile) + "Range"));
 }
Exemplo n.º 8
0
 private MethodInfo GetXileMethod(Xiles xile)
 {
     return(typeof(TInquirer).GetMethod("Get" + Enum.GetName(typeof(Xiles), xile)));
 }
Exemplo n.º 9
0
 public void When_Inquirer_Recieves_Tries_To_Get_Greater(Xiles xile, int size)
 {
     GetXileMethod(xile).Invoke(Helper.NewInquirer <TInquirer>(size: size), new object[] { (int)xile + 1 });
 }
Exemplo n.º 10
0
 public void When_Inquirer_Recieves_Tries_To_Get_Negative(Xiles xile, int size)
 {
     GetXileMethod(xile).Invoke(Helper.NewInquirer <TInquirer>(size: size), new object[] { -1 });
 }