예제 #1
0
        public void SameValueCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "cloned.csv");

            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[0]).Value(), new double[] { 95, 103 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[1]).Value(), new double[] { 95, 103 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[2]).Value(), new double[] { 95, 103 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[3]).Value(), new double[] { 95, 103 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[4]).Value(), new double[] { 95, 103 });
        }
예제 #2
0
        public void CorrectColourCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "colourTest.csv");

            Assert.Equal(((SolidColorBrush)((SummariserNode)loader.GenerateDataset("testData").Nodes[0]).Colour).Color, Color.FromRgb(255, 0, 0));
            Assert.Equal(((SolidColorBrush)((SummariserNode)loader.GenerateDataset("testData").Nodes[1]).Colour).Color, Color.FromRgb(255, 127, 0));
            Assert.Equal(((SolidColorBrush)((SummariserNode)loader.GenerateDataset("testData").Nodes[2]).Colour).Color, Color.FromRgb(255, 255, 0));
            Assert.Equal(((SolidColorBrush)((SummariserNode)loader.GenerateDataset("testData").Nodes[3]).Colour).Color, Color.FromRgb(127, 255, 0));
            Assert.Equal(((SolidColorBrush)((SummariserNode)loader.GenerateDataset("testData").Nodes[4]).Colour).Color, Color.FromRgb(0, 255, 0));
        }
예제 #3
0
        public void CorrectOrderValueCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "outoforder.csv");

            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[0]).Value(), new double[] { 95, 103 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[1]).Value(), new double[] { 119.6, 158.6 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[2]).Value(), new double[] { 109.5, 118 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[3]).Value(), new double[] { 0, 75.3 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[4]).Value(), new double[] { 162.8, 178.9 });
            Assert.Equal(((SummariserNode)loader.GenerateDataset("testData").Nodes[5]).Value(), new double[] { 183.1, 225.3 });
        }
예제 #4
0
        public void CorrectSameNameCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "sameTest.csv");

            Assert.Equal(loader.GenerateDataset("testData").Nodes[0].NodeName, "Hurling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[1].NodeName, "Hurling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[2].NodeName, "Hurling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[3].NodeName, "Hurling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[4].NodeName, "Hurling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[5].NodeName, "Hurling");
        }
 /// <summary>
 /// converts a csv of probability,start,end,activity to a GraphDataset
 /// </summary>
 private GraphDataset CSVToDataset(string url, string name)
 {
     try
     {
         CSVDatasetLoader loader = new CSVDatasetLoader(url);
         startingTimes = loader.AppendDataToSortedList(1, startingTimes);
         endingTimes   = loader.AppendDataToSortedList(2, endingTimes);
         return(loader.GenerateDataset(name));
     }
     catch (Exception e)
     {
         if (e is FileNotFoundException)
         {
             MessageBox.Show("File does not exist");
         }
         else if (e is IOException)
         {
             MessageBox.Show("File is currently being used by another process");
         }
     }
     return(null);
 }
예제 #6
0
        public void NotNullCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "SimpleTest.csv");

            Assert.Equal(loader.GenerateDataset("testData").Nodes.Count, 19);
        }
예제 #7
0
        public void CSVNameSetTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "EmptyTest.csv");

            Assert.Equal(loader.GenerateDataset("testData").DatasetName, "testData");
        }
예제 #8
0
        public void CorrectNameCSVTest()
        {
            CSVDatasetLoader loader = new CSVDatasetLoader(testFilesLocation + "SimpleTest.csv");

            Assert.Equal(loader.GenerateDataset("testData").Nodes[0].NodeName, "Longboarding");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[1].NodeName, "Longboarding");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[2].NodeName, "Longboarding");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[3].NodeName, "BMX");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[4].NodeName, "BMX");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[5].NodeName, "Doing motocross");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[6].NodeName, "Bungee jumping");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[7].NodeName, "Tumbling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[8].NodeName, "Tumbling");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[9].NodeName, "Belly dance");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[10].NodeName, "Fixing the roof");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[11].NodeName, "Bungee jumping");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[12].NodeName, "Bungee jumping");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[13].NodeName, "Bungee jumping");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[14].NodeName, "Rollerblading");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[15].NodeName, "Skateboarding");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[16].NodeName, "Surfing");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[17].NodeName, "Surfing");
            Assert.Equal(loader.GenerateDataset("testData").Nodes[18].NodeName, "Surfing");
        }