public static bool Compare(CanvasDocument doc1, CanvasDocument doc2, TextWriter log)
 {
     using (var temp1 = new TempFile())
         using (var temp2 = new TempFile())
         {
             doc1.SaveToMsApp(temp1.FullPath);
             doc2.SaveToMsApp(temp2.FullPath);
             return(Compare(temp1.FullPath, temp2.FullPath, log));
         }
 }
        // Verify there are no deltas (detected via smart merge) between doc1 and doc2
        // Strict =true, also compare entropy files.
        private static bool HasNoDeltas(CanvasDocument doc1, CanvasDocument doc2, bool strict = false)
        {
            var ourDeltas = Diff.ComputeDelta(doc1, doc1);

            // ThemeDelta always added
            ourDeltas = ourDeltas.Where(x => x.GetType() != typeof(ThemeChange)).ToArray();

            if (ourDeltas.Any())
            {
                foreach (var diff in ourDeltas)
                {
                    Console.WriteLine($"  {diff.GetType().Name}");
                }
                // Error! app shouldn't have any diffs with itself.
                return(false);
            }


            // Save and verify checksums.
            using (var temp1 = new TempFile())
                using (var temp2 = new TempFile())
                {
                    doc1.SaveToMsApp(temp1.FullPath);
                    doc2.SaveToMsApp(temp2.FullPath);

                    bool same;
                    if (strict)
                    {
                        same = Compare(temp1.FullPath, temp2.FullPath, Console.Out);
                    }
                    else
                    {
                        var doc1NoEntropy = RemoveEntropy(temp1.FullPath);
                        var doc2NoEntropy = RemoveEntropy(temp2.FullPath);

                        same = Compare(doc1NoEntropy, doc2NoEntropy, Console.Out);
                    }

                    if (!same)
                    {
                        return(false);
                    }
                }

            return(true);
        }