private string GetCommitHash() { try { return(AssemblyCommitHashExtractor.ExtractFromAssembly(Assembly.GetAssembly(GetType()))); } catch (Exception) { return(null); } }
public object Query() => AppDomain.CurrentDomain .GetAssemblies() .Where(assembly => !assembly.IsDynamic) .OrderBy(assembly => assembly.GetName().Name, StringComparer.OrdinalIgnoreCase) .Select(assembly => new { assembly.GetName().Name, assembly.GetName().Version, CommitHash = AssemblyCommitHashExtractor.ExtractFromAssembly(assembly), BuildTimestamp = AssemblyBuildTimeExtractor.ExtractFromAssembly(assembly)?.ToString("u") }) .ToArray();
public static void ExtractFromAssembly_by_path_should_be_not_null_or_empty() => string.IsNullOrEmpty( AssemblyCommitHashExtractor.ExtractFromAssembly( Assembly.GetAssembly(typeof(AssemblyCommitHashExtractor)).Location)) .Should() .BeFalse();