/// <summary>
        /// Build and write standard telemetry items to  <see cref="Its.Log" />.
        /// </summary>
        protected static void WriteStandardTelemetry()
        {
            /*---------------------------------------------------------------------------*
            * Write telemetry:  Log telemetry general records                           *
            *---------------------------------------------------------------------------*/
            var dateTimeOfSampleInUtc = DateTime.UtcNow;
            var machineDetails        = DomainFactory.CreateMachineDetails();
            var processDetails        = DomainFactory.CreateProcessDetails();

            var processDirectory         = Path.GetDirectoryName(processDetails.FilePath) ?? throw new InvalidOperationException("Could not get directory from process file path: " + processDetails.FilePath);
            var processSiblingAssemblies = Directory.GetFiles(processDirectory, "*", SearchOption.AllDirectories)
                                           .Where(_ => _.ToLowerInvariant().EndsWith(".exe") || _.ToLowerInvariant().EndsWith(".dll")).Select(_ =>
            {
                try
                {
                    return(AssemblyDetails.CreateFromFile(_));
                }
                catch (Exception)
                {
                    return(new AssemblyDetails(Path.ChangeExtension(Path.GetFileName(_), string.Empty), Version.Parse("1.0.0.0").ToString(), _, "UNKNOWN"));
                }
            })
                                           .ToList();

            var diagnosticsTelemetry = new DiagnosticsTelemetry(dateTimeOfSampleInUtc, machineDetails, processDetails, processSiblingAssemblies);

            Its.Log.Instrumentation.Log.Write(() => diagnosticsTelemetry);
        }
        public static void CreateFromFile_VerifyWillUseAlreadyLoadedIfSpecified()
        {
            // NOTE: this is just running the scenario in a separate appdomain to prove it does not get polluted with any additional types when working directly from a file.

            // arrange
            var codeBase         = typeof(AssemblyDetails).Assembly.CodeBase;
            var assemblyFilePath = new Uri(codeBase).PathAndQuery.Replace('/', Path.DirectorySeparatorChar);

            // act
            var firstFromCurrentAppDomainLoadedTypes = AssemblyDetails.CreateFromFile(assemblyFilePath);

            // assert
            firstFromCurrentAppDomainLoadedTypes.Should().NotBeNull();
            AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic).SelectMany(
                a =>
            {
                try
                {
                    return(a.GetExportedTypes());
                }
                catch (Exception)
                {
                    /* no-op */
                }

                return(Enumerable.Empty <Type>());
            }).SingleOrDefault(_ => _.Name == nameof(AssemblyDetails)).Should().NotBeNull();

            // act
            Action <string> action = localAssemblyFilePath => AssemblyDetails.CreateFromFile(localAssemblyFilePath, false);

            // using a dedicated AppDomain so if there are issues it will not pollute the existing AppDomain which is used for serialization et al. in other tests.
            using (var domain = AppDomainHelper.CreateDisposableAppDomain())
            {
                action.ExecuteInAppDomain(assemblyFilePath, domain);
                action.ExecuteInAppDomain(assemblyFilePath, domain);

                // assert
                var loadedAssemblyDetails = domain.AppDomain.GetAssemblies()
                                            .Where(a => !a.IsDynamic)
                                            .SelectMany(
                    a =>
                {
                    try
                    {
                        return(a.GetExportedTypes());
                    }
                    catch (Exception)
                    {
                        /* no-op */
                    }

                    return(Enumerable.Empty <Type>());
                })
                                            .Where(_ => _.Name == nameof(AssemblyDetails))
                                            .ToList();

                loadedAssemblyDetails.Should().HaveCount(1);
            }
        }