public void TestBinaryLoggerRoundtrip()
        {
            var binLog       = GetFullPath("1.binlog");
            var binaryLogger = new BinaryLogger();

            binaryLogger.Parameters = binLog;
            MSBuild.BuildProject(s_testProject, binaryLogger);

            var build = Serialization.Read(binLog);
            var xml1  = GetFullPath("1.xml");

            Serialization.Write(build, xml1);

            Serialization.Write(build, GetFullPath("1.buildlog"));
            build = Serialization.Read(GetFullPath("1.buildlog"));
            Serialization.Write(build, GetFullPath("2.xml"));

            Assert.False(Differ.AreDifferent(xml1, GetFullPath("2.xml")));

            build = XlinqLogReader.ReadFromXml(xml1);
            Serialization.Write(build, GetFullPath("3.xml"));
            Assert.False(Differ.AreDifferent(xml1, GetFullPath("3.xml")));

            build = Serialization.Read(xml1);
            Serialization.Write(build, GetFullPath("4.xml"));

            Assert.False(Differ.AreDifferent(xml1, GetFullPath("4.xml")));
        }
        public void TestBinaryLoggerRoundtrip(bool useInMemoryProject)
        {
            var binLog       = GetTestFile("1.binlog");
            var binaryLogger = new BinaryLogger();

            binaryLogger.Parameters = binLog;
            var buildSuccessful = useInMemoryProject
                ? MSBuild.BuildProjectInMemory(s_testProject, binaryLogger)
                : MSBuild.BuildProjectFromFile(s_testProject, binaryLogger);

            Assert.True(buildSuccessful);

            var build = Serialization.Read(binLog);
            var xml1  = GetTestFile("1.xml");
            var xml2  = GetTestFile("2.xml");

            Serialization.Write(build, xml1);

            Serialization.Write(build, GetTestFile("1.buildlog"));
            build = Serialization.Read(GetTestFile("1.buildlog"));

            Serialization.Write(build, xml2);

            Assert.False(Differ.AreDifferent(xml1, xml2));

            build = XlinqLogReader.ReadFromXml(xml1);
            Serialization.Write(build, GetTestFile("3.xml"));
            Assert.False(Differ.AreDifferent(xml1, GetTestFile("3.xml")));

            build = Serialization.Read(xml1);
            Serialization.Write(build, GetTestFile("4.xml"));

            Assert.False(Differ.AreDifferent(xml1, GetTestFile("4.xml")));
        }
Ejemplo n.º 3
0
        //[Fact]
        public void SearchPerf()
        {
            var file    = @"D:\contentsync.xml";
            var build   = XlinqLogReader.ReadFromXml(file);
            var sw      = Stopwatch.StartNew();
            var search  = new Search(build);
            var results = search.FindNodes("test");
            var elapsed = sw.Elapsed;

            MessageBox.Show(elapsed.ToString());
            File.WriteAllLines(@"D:\2.txt", results.Select(r => r.Field).ToArray());
        }
Ejemplo n.º 4
0
 //[Fact]
 public void RoundtripTest()
 {
     foreach (var file in Directory.GetFiles(@"D:\XmlBuildLogs", "*.xml", SearchOption.AllDirectories).ToArray())
     {
         var build   = XlinqLogReader.ReadFromXml(file);
         var newName = Path.ChangeExtension(file, ".new.xml");
         XmlLogWriter.WriteToXml(build, newName);
         var source      = File.ReadAllText(file);
         var destination = File.ReadAllText(newName);
         if (source != destination)
         {
             Process.Start("devenv", $"/diff \"{file}\" \"{newName}\"");
             break;
         }
         else
         {
             File.Delete(newName);
         }
     }
 }