public void ProcessRuntimeDescriptorSaveTest()
        {
            AssemblyManagementRepository repo = GetAssemblyManagementRepository(GetConsoleLogger(), nameof(ProcessRuntimeDescriptorSaveTest));

            repo.SetDaoNamespace <ProcessRuntimeDescriptor>();
            repo.Database.TryEnsureSchema <Dao.AssemblyDescriptor>();
            List <AssemblyDescriptor> descriptors = AssemblyDescriptor.GetCurrentAppDomainDescriptors().ToList();
            ProcessRuntimeDescriptor  current     = ProcessRuntimeDescriptor.PersistCurrentToRepo(repo);

            Expect.AreEqual(descriptors.Count, current.AssemblyDescriptors.Length, "Number of descriptors didn't match");

            ProcessRuntimeDescriptor retrieved = repo.Retrieve <ProcessRuntimeDescriptor>(current.Id);

            Expect.AreEqual(descriptors.Count, retrieved.AssemblyDescriptors.Length, "Number of retrieved descriptors didn't match");

            foreach (AssemblyDescriptor descriptor in retrieved.AssemblyDescriptors)
            {
                AssemblyDescriptor retrievedDescriptor = repo.Retrieve <AssemblyDescriptor>(descriptor.Uuid);
                Message.PrintLine("Checking {0}", ConsoleColor.DarkBlue, retrievedDescriptor.AssemblyFullName);
                AssemblyDescriptor actual = descriptors.FirstOrDefault(d =>
                                                                       d.Name.Equals(retrievedDescriptor.Name) &&
                                                                       d.FileHash.Equals(retrievedDescriptor.FileHash) &&
                                                                       d.AssemblyFullName.Equals(retrievedDescriptor.AssemblyFullName)
                                                                       );

                Expect.AreEqual(actual.AssemblyReferenceDescriptors?.Count, retrievedDescriptor.AssemblyReferenceDescriptors?.Count);
                Message.PrintLine("ProcessRuntimeDescriptors count {0}", retrievedDescriptor.ProcessRuntimeDescriptors.Count);
            }
        }
        public void SaveDescriptorSavesReferences()
        {
            AssemblyManagementRepository repo = GetAssemblyManagementRepository(GetConsoleLogger(), nameof(SaveDescriptorSavesReferences));

            repo.Database.TryEnsureSchema <Dao.AssemblyDescriptor>();
            AssemblyDescriptor[] descriptors = AssemblyDescriptor.GetCurrentAppDomainDescriptors().ToArray();

            foreach (AssemblyDescriptor descriptor in descriptors)
            {
                int?referenceCount = descriptor.AssemblyReferenceDescriptors?.Count;
                if (referenceCount > 0)
                {
                    AssemblyDescriptor wrapped   = repo.Save(descriptor);
                    AssemblyDescriptor retrieved = repo.Retrieve <AssemblyDescriptor>(wrapped.Id);
                    Expect.AreEqual(referenceCount, retrieved.AssemblyReferenceDescriptors?.Count);
                    Pass(descriptor.AssemblyFullName + " " + referenceCount.ToString());
                }
                else
                {
                    Message.PrintLine("No references: {0}", ConsoleColor.Cyan, descriptor.AssemblyFullName);
                }
            }
        }