Exemple #1
0
        public static int Main(string[] args)
        {
            var synchronousConnection  = new Apis(typeof(SQLiteConnection), Apis.connectionIgnores);
            var asynchronousConnection = new Apis(typeof(SQLiteAsyncConnection), Apis.connectionIgnores, "Async");
            var n = asynchronousConnection.DumpComparison(synchronousConnection);

            var synchronousQuery  = new Apis(typeof(TableQuery <>), Apis.queryIgnores);
            var asynchronousQuery = new Apis(typeof(AsyncTableQuery <>), Apis.queryIgnores, "Async");

            n += asynchronousQuery.DumpComparison(synchronousQuery);

            return(n > 0 ? 1 : 0);
        }
Exemple #2
0
        public int DumpComparison(Apis other)
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("## " + type.FullName);
            Console.WriteLine();

            var diff = new ListDiff <Api, Api> (All, other.All, (x, y) => x.Index == y.Index);

            var n = 0;

            foreach (var a in diff.Actions)
            {
                switch (a.ActionType)
                {
                case ListDiffActionType.Add:
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine($"- [ ] *add* `{a.DestinationItem.Index.Replace('`', '_')}`");
                    n++;
                    break;

                case ListDiffActionType.Remove:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"- [ ] *remove* `{a.SourceItem.Index.Replace('`', '_')}`");
                    n++;
                    break;

                case ListDiffActionType.Update:
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine($"- [x] `{a.SourceItem.Index.Replace('`', '_')}`");
                    break;
                }
            }
            Console.ResetColor();
            Console.WriteLine();
            Console.WriteLine($"**{n}** differences");
            Console.WriteLine();

            return(n);
        }