Explain the difference between dotcover running tests and running by hand.

Ok, in dotcover 2.7, Resharper 8.2.  VS2012 I have the following code


public static string[] ListUninstalls()
        {
            // ReSharper disable PossibleNullReferenceException
            var keys = Registry.LocalMachine.OpenSubKey("SOFTWARE").OpenSubKey("Microsoft").OpenSubKey("Windows");
            keys = keys.OpenSubKey("CurrentVersion").OpenSubKey("Uninstall");
 
            var keyValues =
                keys.GetSubKeyNames()
                    .Select(
                        key =>
                            Registry.GetValue(
                                @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\" + key,
                                "DisplayName",
                                null) as string)
                    .Where(c => c != null)
                    .ToArray();
 
            // ReSharper restore PossibleNullReferenceException
            return keyValues;
        }


And the test method

        [TestMethod]
        public void UninstallListTest()
        {
            var location = Extensions.ListUninstalls();
            Assert.AreEqual(0, location.Length);
        }


If I right click on test and choose "Run Unit Test" it fails with
Assert.AreEqual failed. Expected:<0>. Actual:<93>

Ok, but if I right click on test and choose "Cover unit tests with dotCover", it fails with
Assert.AreEqual failed. Expected:<0>. Actual:<328>.

Clearly these are running with something different, user? permissions? ???

Can anyone explain this to me.

Thank you

0

Please sign in to leave a comment.