public void LoadOpenCoverProfilerInstead_IgnoresUnexpectedTypes(Type type) { // arrange var instance = Activator.CreateInstance(type); // type must have a paramterless constructor // act/assert Assert.DoesNotThrow(() => FakesHelper.LoadOpenCoverProfilerInstead(instance)); }
public void LoadOpenCoverProfilerInstead_DoesNotAlterProfilerIfNotEnabled() { // arrange var dict = new Dictionary <string, string>() { { "COR_ENABLE_PROFILING", "0" }, { "COR_PROFILER", "{0000002F-0000-0000-C000-000000000046}" } // not a real profiler just a COM object that should exist on every box }; // act Assert.DoesNotThrow(() => FakesHelper.LoadOpenCoverProfilerInstead(dict)); // assert Assert.AreEqual("{0000002F-0000-0000-C000-000000000046}", dict["COR_PROFILER"]); }
public void LoadOpenCoverProfilerInstead_DoesNotAlterProfilerIfCurrentProfilerIsOpenCover() { // arrange var dict = new Dictionary <string, string>() { { "COR_ENABLE_PROFILING", "1" }, { "COR_PROFILER", "{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}" } // not a real profiler just a COM object that should exist on every box }; // act Assert.DoesNotThrow(() => FakesHelper.LoadOpenCoverProfilerInstead(dict)); // assert Assert.AreEqual("{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}", dict["COR_PROFILER"]); Assert.IsFalse(dict.ContainsKey("CHAIN_EXTERNAL_PROFILER")); Assert.IsFalse(dict.ContainsKey("CHAIN_EXTERNAL_PROFILER_LOCATION")); }
public void LoadOpenCoverProfilerInstead_SwapsOutOriginalProfilerForOpenCover() { // arrange var dict = new Dictionary <string, string>() { { "COR_ENABLE_PROFILING", "1" }, { "COR_PROFILER", "{0000002F-0000-0000-C000-000000000046}" } // not a real profiler just a COM object that should exist on every box }; // act Assert.DoesNotThrow(() => FakesHelper.LoadOpenCoverProfilerInstead(dict)); // assert Assert.AreEqual("{1542C21D-80C3-45E6-A56C-A9C1E4BEB7B8}", dict["COR_PROFILER"]); Assert.AreEqual("{0000002F-0000-0000-C000-000000000046}", dict["CHAIN_EXTERNAL_PROFILER"]); Assert.IsTrue(dict["CHAIN_EXTERNAL_PROFILER_LOCATION"].EndsWith("oleaut32.dll", StringComparison.InvariantCultureIgnoreCase)); }