Exemplo n.º 1
0
 public void ExcelParser()
 {
     ExcelParser excel = new ExcelParser();
     string path = @"TestFiles/ExcelFile.xlsx";
     RawData data;
     bool success = excel.TryParseData(path, out data);
     Assert.IsTrue(success);
     string[] groupNames = new[] {"A", "B", "C", "D", "E"};
     List<double[]> expectedArrays = new List<double[]>
     {
         new[] {1d, 4, 2, 7, 8, 3, 1, 2, 3, 3},
         new[] {5.3, 2, 7.5, 54, 23, 16},
         new[] {84d, 14, 34, 17, 26},
         new[] {57.7334, 16.6543, 45, 35.333335, 45, 95.0000000001, 65, 33},
         new[] {13.4444444444444, 1, 0, 100, 99, 8008135, 77777777777777}
     }
         ;
     List<double[]> actualArrays = new List<double[]>
     {
         data[0].Entries.ToArray(),
         data[1].Entries.ToArray(),
         data[2].Entries.ToArray(),
         data[3].Entries.ToArray(),
         data[4].Entries.ToArray()
     };
     for (int i = 0; i < 5; i++)
     {
         double[] expectedDoubles = expectedArrays[i];
         double[] actualDoubles = actualArrays[i];
         for (int j = 0; j < expectedDoubles.Length; j++)
         {
             Assert.AreEqual(expectedDoubles[j], actualDoubles[j]);
         }
     }
 }
Exemplo n.º 2
0
 /*
 SmallCsvFile has the values:
 A:  B:  C:
 1   6   11
 2   7   12
 3   8   13
 4   9   14
 5   10  15
 ---------
 Averages:
 3   8   13
 Grand Mean = 8
 SST = 280
 SSW = 30
 SSB = 250
 dft = 14
 dfw = 12
 dfb = 2
 msb = 125
 msw = 2.5
 F = 50
 */
 public AnovaTestsExcel()
 {
     rData = new RawData();
     //CsvParser parser = new CsvParser();
     ExcelParser parser = new ExcelParser();
     bool parsed = parser.TryParseData(@"TestFiles/SmallExcelFile.xlsx", out rData);
     data = new AnovaOneway(rData);
 }
Exemplo n.º 3
0
        public void ExcelParserSmall()
        {
            ExcelParser excel = new ExcelParser();
            string path = @"TestFiles/SmallExcelFile.xlsx";
            RawData data;
            bool success = excel.TryParseData(path, out data);
            Assert.IsTrue(success);
            string[] groupNames = new[] {"A", "B", "C"};

            List<double[]> expectedArrays = new List<double[]>
            {
                new[] {1d, 2, 3, 4, 5},
                new[] {6d, 7, 8, 9, 10},
                new[] {11d, 12, 13, 14, 15}
            };
            List<double[]> actualArrays = new List<double[]>
            {
                data[0].Entries.ToArray(),
                data[1].Entries.ToArray(),
                data[2].Entries.ToArray(),
            };
            for (int i = 0; i < 3; i++)
            {
                double[] expectedDoubles = expectedArrays[i];
                double[] actualDoubles = actualArrays[i];
                for (int j = 0; j < expectedDoubles.Length; j++)
                {
                    Assert.AreEqual(expectedDoubles[j], actualDoubles[j]);
                }
            }
        }