< Summary

Class:SharpHoundCommonLib.SHRegistryKey
Assembly:SharpHoundCommonLib
File(s):D:\a\SharpHoundCommon\SharpHoundCommon\src\CommonLib\IRegistryKey.cs
Covered lines:0
Uncovered lines:9
Coverable lines:9
Total lines:34
Line coverage:0% (0 of 9)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%100%
GetValue(...)0%200%

File(s)

D:\a\SharpHoundCommon\SharpHoundCommon\src\CommonLib\IRegistryKey.cs

#LineLine coverage
 1using Microsoft.Win32;
 2
 3namespace SharpHoundCommonLib
 4{
 5    public interface IRegistryKey
 6    {
 7        public object GetValue(string subkey, string name);
 8    }
 9
 10    public class SHRegistryKey : IRegistryKey
 11    {
 12        private RegistryKey _currentKey;
 13
 014        public SHRegistryKey(RegistryHive hive, string machineName)
 015        {
 016            var remoteKey = RegistryKey.OpenRemoteBaseKey(hive, machineName);
 017            _currentKey = remoteKey;
 018        }
 19
 20        public object GetValue(string subkey, string name)
 021        {
 022            var key = _currentKey.OpenSubKey(subkey);
 023            return key?.GetValue(name);
 024        }
 25    }
 26
 27    public class MockRegistryKey : IRegistryKey
 28    {
 29        public virtual object GetValue(string subkey, string name)
 30        {
 31            throw new System.NotImplementedException();
 32        }
 33    }
 34}