I have written a code to install a special code in the machine or not. When I test this codebie debugging, it works as if I expect it.
But, when I argue and urge through the N-Unit, then getting the wrong output I suspect that the N-Unit is not reaching the registry entry.
Can someone provide your suggestions on this and guide me to go along with the right path?
The following is my EN-Unit code
[Examination] public isiDistalled () {Assert.IsTrue (GetInstalledDetail.IsInstalled ("1.4.0.2")); Assert.IsFalse (GetInstalledDetail.IsInstalled ("1.4.0.3")); }
Here is the method code installed:
Public static Bull Installed (string version) {string path = string.Empty; Bull results = False; String sLocation = "software \\ a \" installed version "; String sLocation64bit = "software \\ WOW6432Node \\ a \\ installed version"; Registry key, version key; Key = Registry.LocalMachine OpenSocial (SOLOCTION); If (key == null) {key = Registry.LocalMachine.OpenSubKey (sLocation64bit); Slocation = sLocation64bit; } If (key! = Null) {foreach (string isVersion in key.GetSubKeyNames ()) {ifVersion == version} {versionKey = Registry.LocalMachine.OpenSubKey (sLocation + "\\" + version); Try {path = versionKey.GetValue ("") as a string; If (Directory.EnumerateFiles (path, "*", SearchOption.AllDirectories). Any ()) {Results = true; break; } And {result = false; }} Hold (exception exception) {result = false; }}}} Return result; }
Thanks in advance!
No comments:
Post a Comment