private static void ExecuteConversion(ExcelRowsWithDependencies excel)
        {
            ExcelRowsConverterToGraphViz convertor = new ExcelRowsConverterToGraphViz();
            DotGraph graph       = convertor.Convert(excel).GeneratedGraph;
            string   graphInText = graph.Compile();

            File.WriteAllText(@"C:\dev\examples\ProjectDependencyGraph\UnitTestProject1\bin\Debug\ConvertToGraphViz1.dot", graphInText);
        }
        public void Load_Basic_Success()
        {
            StructureOfExcelFile testFileStructure = new StructureOfExcelFile("Work Items", 1, 7, 2, "4,3,2", 6);
            var er = new ExcelReader(testFileStructure, @".\LoadMe1.xlsx");
            ExcelRowsWithDependencies rows = er.Load().LoadedExcel;

            Assert.IsNotNull(rows);
            Assert.IsTrue(rows.Any());
        }
        private static ExcelRowsWithDependencies CreateBasicExcel()
        {
            ExcelRowsWithDependencies excel = new ExcelRowsWithDependencies(new ExcelRow[]
            {
                new ExcelRow(1, "1", null, 0),
                new ExcelRow(2, "2", "1", 0),
                new ExcelRow(3, "3", "1", 0),
            });

            return(excel);
        }
        internal static ExcelRowsWithDependencies CreateExcelWithParentsDefinedLater()
        {
            ExcelRowsWithDependencies excel = new ExcelRowsWithDependencies(new ExcelRow[]
            {
                new ExcelRow(1, "1", null, 0),
                new ExcelRow(2, "2", "3", 0),
                new ExcelRow(3, "3", "1", 0),
            });

            return(excel);
        }
        public void Sort_Basic_SortedCorrectly()
        {
            ExcelRowsWithDependencies excelRows = ExcelRowsForTests.CreateExcelWithParentsDefinedLater();
            int i = 0;

            int[] expectedOrder = { 1, 3, 2 };
            foreach (ExcelRow row in excelRows)
            {
                Assert.AreEqual(expectedOrder[i], row.Key);
                i++;
            }
        }
        private static ExcelRowsWithDependencies CreateExcelWithParallelFlows()
        {
            ExcelRowsWithDependencies excel = new ExcelRowsWithDependencies(new ExcelRow[]
            {
                new ExcelRow(1, "1", null, 0),
                new ExcelRow(2, "2", "1", 0),
                new ExcelRow(3, "3", "1", 0),

                new ExcelRow(4, "4", null, 0),
                new ExcelRow(5, "5", "4", 0),
                new ExcelRow(6, "6", "4", 0),

                new ExcelRow(7, "7", "4,1", 0),
            });

            return(excel);
        }
        public void Sort_ParentsCombination_SortedCorrectly()
        {
            /*
             *  new ExcelRow(1, "1", null),
             *  new ExcelRow(2, "2", "3,6"),
             *  new ExcelRow(7, "7", "2"),
             *  new ExcelRow(3, "3", "1"),
             *  new ExcelRow(6, "6", null),
             */
            ExcelRowsWithDependencies excelRows = ExcelRowsForTests.CreateExcelWithMoreAdvancedParentsDefinedLater();
            int i = 0;

            int[] expectedOrder = { 1, 3, 6, 2, 7 };
            foreach (ExcelRow row in excelRows)
            {
                Assert.AreEqual(expectedOrder[i], row.Key);
                i++;
            }
        }
예제 #8
0
        private static (DotGraph GeneratedGraph, string ConversionErrors) ConvertToGraph(ExcelRowsWithDependencies excel)
        {
            ExcelRowsConverterToGraphViz convertor = new ExcelRowsConverterToGraphViz();

            return(convertor.Convert(excel));
        }
        public void ConvertToGraphViz_NoAllParerntsDefined_ConvertedByThrows()
        {
            ExcelRowsWithDependencies excel = CreateExcelNotAllParentsDefined();

            ExecuteConversion(excel);
        }
        public void ConvertToGraphViz_ParerntsDefinedLaterMoreAdvanced_Success()
        {
            ExcelRowsWithDependencies excel = ExcelRowsForTests.CreateExcelWithMoreAdvancedParentsDefinedLater();

            ExecuteConversion(excel);
        }
        public void ConvertToGraphViz_ParallelFlows_Success()
        {
            ExcelRowsWithDependencies excel = CreateExcelWithParallelFlows();

            ExecuteConversion(excel);
        }
        public void ConvertToGraphViz_Basic_Success()
        {
            ExcelRowsWithDependencies excel = CreateBasicExcel();

            ExecuteConversion(excel);
        }