コード例 #1
0
ファイル: Test.cs プロジェクト: xuantientran/Exercice
        public static void TestComparison()
        {
            //string pathDataTree = @"D:\Donnees_VParis\PSBDADSU_VIL.C11_180126_003118_9.026.756_77.327.txt";
            //string pathDataTree2 = @"D:\Donnees_VParis\PSBDADSU_VIL.C11_180126_003118_9.026.756_77.327.modifie.txt";

            Stopwatch muniteur = new Stopwatch();

            muniteur.Start();

            using (StreamWriter writer = new StreamWriter(pathResult, false))
            {
                IDsnTree        dsnTree   = DsnTreeFactory.LoadTree(pathDsnTree);
                IDataTree       dataTree  = DsnTreeFactory.loadDataTree(dsnTree, pathDataTree);
                IDataTree       dataTree2 = DsnTreeFactory.loadDataTree(dsnTree, pathDataTree2);
                IDsnData        dsnData   = new DsnData(dataTree);
                IDsnData        dsnData2  = new DsnData(dataTree2);
                List <DataItem> dataItems = new List <DataItem>();
                foreach (var employee in dsnData.Employees)
                {
                    if (dsnData2.Employees.ContainsKey(employee.Key))
                    {
                        var employee2 = dsnData2.Employees[employee.Key];
                        Comparison.CompareDictionary(employee.Value.EmployeeDataBlock.Leaves.First().Data, employee2.EmployeeDataBlock.Leaves.First().Data, dataItems);

                        foreach (var activityPeriod in employee.Value.ActivityPeriods)
                        {
                            var activityPeriod2 = employee2.ActivityPeriods.Find(item => item.BeginDate.Equals(activityPeriod.BeginDate));
                            if (activityPeriod2 != null)
                            {
                                Comparison.TextDiff(activityPeriod2.ToString(), activityPeriod.ToString(), dataItems, true);
                            }
                        }
                    }
                }
                foreach (var item in dataItems)
                {
                    switch (item.Status)
                    {
                    case ChangeStatus.Deleted:
                        writer.Write("- ");
                        break;

                    case ChangeStatus.Inserted:
                        writer.Write("+ ");
                        break;

                    case ChangeStatus.Modified:
                        writer.Write("* ");
                        break;

                    default:
                        writer.Write("  ");
                        break;
                    }
                    writer.WriteLine(item.Key + ",'" + item.Value + "','" + item.OldValue + "'");
                }
            }
            muniteur.Stop();
            Console.WriteLine("Comparision in " + muniteur.Elapsed + " seconds");
        }
コード例 #2
0
        public void T00_loading_simple_test_data()
        {
            var tree = DsnTreeFactory.LoadTree(Path.Combine(GetDataDirectory(), "Example0", "TestData.txt"));

            tree.Should().NotBeNull();
            tree.Count.Should().Be(1);
            tree.Find("S67.G10.09").Label.Should().Be("Label number 0");
            tree.Find("S67.G10.09").Cardinality.Should().Be(new DsnCardinality(0, 1));
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: xuantientran/Exercice
 public static void TestToString()
 {
     using (StreamWriter writer = new StreamWriter(pathResult, false))
     {
         IDsnTree  dsnTree  = DsnTreeFactory.LoadTree(pathDsnTree);
         IDataTree dataTree = DsnTreeFactory.loadDataTree(dsnTree, pathDataTree);
         IDsnData  dsnData  = new DsnData(dataTree);
         writer.Write(dsnData.DataDispatch.ToString());
     }
 }
コード例 #4
0
ファイル: Test.cs プロジェクト: xuantientran/Exercice
        public static void TestTree()
        {
            var      path    = Path.Combine(GetDataDirectory(), "Example0", "dsn.txt");
            IDsnTree dsnTree = DsnTreeFactory.LoadTree(path);
            var      l       = ((DsnTree)dsnTree).GetPathToNode("S40.G05.00");

            foreach (var n in l)
            {
                Console.WriteLine(n);
            }

            /*
             * foreach (var n in ((DSNTree)tree).DsnNodes)
             *      Console.WriteLine(n.Key);
             * foreach(var n in tree.Root.Children)
             * {
             *      Console.WriteLine(n.Id);
             * }
             * Utilitaire.Traverse(tree.Root);
             */
        }