< Summary

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

Metrics

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

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
 14        public SHRegistryKey(RegistryHive hive, string machineName)
 15        {
 16            var remoteKey = RegistryKey.OpenRemoteBaseKey(hive, machineName);
 17            _currentKey = remoteKey;
 18        }
 19
 20        public object GetValue(string subkey, string name)
 21        {
 22            var key = _currentKey.OpenSubKey(subkey);
 23            return key?.GetValue(name);
 24        }
 25    }
 26
 27    public class MockRegistryKey : IRegistryKey
 28    {
 29        public virtual object GetValue(string subkey, string name)
 030        {
 031            throw new System.NotImplementedException();
 32        }
 33    }
 34}