static public RegValue[] ImportFrom(string regFile) { var result = new List<RegValue>(); string content = System.IO.File.ReadAllText(regFile); var parser = new RegParser(); char[] delimiter = new[] { '\\' }; foreach (KeyValuePair<string, Dictionary<string, string>> entry in parser.Parse(content)) foreach (KeyValuePair<string, string> item in entry.Value) { string path = entry.Key; var regval = new RegValue(); regval.Root = GetHive(path); regval.Key = path.Split(delimiter, 2).Last(); regval.Name = item.Key; regval.Value = Deserialize(item.Value, parser.Encoding); if (regval.Value != null) result.Add(regval); } return result.ToArray(); }
public void StartWithArguments() { var controller = new ServiceController(_testService.TestServiceName); Assert.Equal(ServiceControllerStatus.Running, controller.Status); controller.Stop(); controller.WaitForStatus(ServiceControllerStatus.Stopped, _testService.ControlTimeout); Assert.Equal(ServiceControllerStatus.Stopped, controller.Status); var args = new[] { "a", "b", "c", "d", "e" }; controller.Start(args); controller.WaitForStatus(ServiceControllerStatus.Running, _testService.ControlTimeout); Assert.Equal(ServiceControllerStatus.Running, controller.Status); // The test service writes the arguments that it was started with to the _testService.TestServiceRegistryKey. // Read this key to verify that the arguments were properly passed to the service. string argsString = Registry.GetValue(_testService.TestServiceRegistryKey, "ServiceArguments", null) as string; Assert.Equal(string.Join(",", args), argsString); }
public static string GetInputText(string oldString) { Main.<>c__DisplayClassc <>c__DisplayClassc = new Main.<>c__DisplayClassc(); <>c__DisplayClassc.oldString = oldString; if (!Main.hasFocus) { return <>c__DisplayClassc.oldString; } Main.inputTextEnter = false; Main.inputTextEscape = false; string text = <>c__DisplayClassc.oldString; <>c__DisplayClassc.newKeys = ""; if (text == null) { text = ""; } bool flag = false; if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl)) { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z)) { text = ""; } else { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X)) { Thread thread = new Thread(delegate { if (<>c__DisplayClassc.oldString.Length > 0) { Clipboard.SetText(<>c__DisplayClassc.oldString); } }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); while (thread.IsAlive) { } text = ""; } else { if ((Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C)) || (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert))) { Thread thread2 = new Thread(delegate { if (<>c__DisplayClassc.oldString.Length > 0) { Clipboard.SetText(<>c__DisplayClassc.oldString); } }); thread2.SetApartmentState(ApartmentState.STA); thread2.Start(); while (thread2.IsAlive) { } } else { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V)) { Thread thread3 = new Thread(delegate { string text3 = Clipboard.GetText(); for (int l = 0; l < text3.Length; l++) { if (text3[l] < ' ' || text3[l] == '\u007f') { text3 = text3.Replace(string.Concat(text3[l--]), ""); } } <>c__DisplayClassc.newKeys += text3; }); thread3.SetApartmentState(ApartmentState.STA); thread3.Start(); while (thread3.IsAlive) { } } } } } } else { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) || Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightShift)) { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete)) { Thread thread4 = new Thread(delegate { if (<>c__DisplayClassc.oldString.Length > 0) { Clipboard.SetText(<>c__DisplayClassc.oldString); } }); thread4.SetApartmentState(ApartmentState.STA); thread4.Start(); while (thread4.IsAlive) { } text = ""; } if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert)) { Thread thread5 = new Thread(delegate { string text3 = Clipboard.GetText(); for (int l = 0; l < text3.Length; l++) { if (text3[l] < ' ' || text3[l] == '\u007f') { text3 = text3.Replace(string.Concat(text3[l--]), ""); } } <>c__DisplayClassc.newKeys += text3; }); thread5.SetApartmentState(ApartmentState.STA); thread5.Start(); while (thread5.IsAlive) { } } } for (int i = 0; i < Main.keyCount; i++) { int num = Main.keyInt[i]; string str = Main.keyString[i]; if (num == 13) { Main.inputTextEnter = true; } else { if (num == 27) { Main.inputTextEscape = true; } else { if (num >= 32 && num != 127) { Main.<>c__DisplayClassc expr_2D1 = <>c__DisplayClassc; expr_2D1.newKeys += str; } } } } } Main.keyCount = 0; text += <>c__DisplayClassc.newKeys; Main.oldInputText = Main.inputText; Main.inputText = Keyboard.GetState(); Microsoft.Xna.Framework.Input.Keys[] pressedKeys = Main.inputText.GetPressedKeys(); Microsoft.Xna.Framework.Input.Keys[] pressedKeys2 = Main.oldInputText.GetPressedKeys(); if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back) && Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back)) { if (Main.backSpaceCount == 0) { Main.backSpaceCount = 7; flag = true; } Main.backSpaceCount--; } else { Main.backSpaceCount = 15; } for (int j = 0; j < pressedKeys.Length; j++) { bool flag2 = true; for (int k = 0; k < pressedKeys2.Length; k++) { if (pressedKeys[j] == pressedKeys2[k]) { flag2 = false; } } string text2 = string.Concat(pressedKeys[j]); if (text2 == "Back" && (flag2 || flag) && text.Length > 0) { text = text.Substring(0, text.Length - 1); } } return text; }
public string GetMsBuildPath() { var versions = new[] { "12.0", "4.0", "3.5", "2.0" }; foreach (var version in versions) { var regKey = @"HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions\" + version; var rk = Registry.LocalMachine.OpenSubKey(regKey, false); if (rk.IsInstance() && rk.GetValue("MSBuildToolsPath").IsInstance()) { return rk.GetValue("MSBuildToolsPath") + "MsBuild.exe"; } } return null; }
/// <summary> /// /// </summary> /// <param name="path"></param> /// <returns></returns> public static IEnumerable<string[]> ReadCsv(string path) { char[] separator = new[] { ',' }; string currentLine; using (var stream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)) { using (var reader = new StreamReader(stream, Encoding.Default, true, 1024)) { while ((currentLine = reader.ReadLine()) != null) { yield return currentLine.Split(separator, StringSplitOptions.None); } reader.Dispose(); reader.Close(); } stream.Dispose(); stream.Close(); } }
public RegistryStorage(Win32.RegistryKey rootKey, string subkey) { this.regKey = rootKey.CreateSubKey(subkey); }
static TestCaseData should_return_true_if_all_profilers_have_already_been_installed() { var fixture = new Fixture().Customize(new AutoMoqCustomization()); var machinePreq = new MachinePrerequisite("2.0.0"); { var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; var @params = new[] { new ParameterForHasBeenInstalled() { RegistryView = profLocs[0].RegistryView, ClassesRootKey = RegistryKeyMixin.DummyX86ClassesRootKey, InProcServer32Key = RegistryKeyMixin.DummyX86InProcServer32Key, ProfilerPath = @"C:\Users\Akira\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\jvtxkz2r.sld\tools\x86\Urasandesu.Prig.dll", ProfilerExistence = true, ProfilerFileDescription = "Prig Profiler 2.0.0 Type Library" }, new ParameterForHasBeenInstalled() { RegistryView = profLocs[1].RegistryView, ClassesRootKey = RegistryKeyMixin.DummyX64ClassesRootKey, InProcServer32Key = RegistryKeyMixin.DummyX64InProcServer32Key, ProfilerPath = @"C:\Users\Akira\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\jvtxkz2r.sld\tools\x64\Urasandesu.Prig.dll", ProfilerExistence = true, ProfilerFileDescription = "Prig Profiler 2.0.0 Type Library" } }; fixture.Inject(MockEnvironmentRepository(profLocs, @params)); } return new TestCaseData(machinePreq, fixture).Returns(true).SetName("should_return_true_if_all_profilers_have_already_been_installed"); }
public void Install_should_call_installation_steps_by_a_fixed_sequence() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var mwInstl = new MachineWideInstallation("2.0.0"); fixture.FreezeUninstalledEnvironment(); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()) }; { var m = fixture.Freeze<Mock<IEnvironmentRepository>>(); m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs); m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView)).Returns(RegistryKeyMixin.DummyX86ClassesRootKey); m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(RegistryKeyMixin.DummyX86InProcServer32Key); m.Setup(_ => _.GetRegistryValue(RegistryKeyMixin.DummyX86InProcServer32Key, null)).Returns(fixture.Create<string>()); } var mocks = new MockRepository(MockBehavior.Strict); var order = new MockOrder(); mwInstl.Preparing += mocks.InOrder<Action>(order, m => m.Setup(_ => _())).Object; mwInstl.ProfilerStatusChecking += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object; mwInstl.NuGetPackageCreating += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object; mwInstl.NuGetPackageCreated += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object; mwInstl.NuGetSourceRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object; mwInstl.NuGetSourceRegistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object; mwInstl.EnvironmentVariableRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object; mwInstl.EnvironmentVariableRegistered += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object; mwInstl.ProfilerRegistering += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object; mwInstl.ProfilerRegistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object; mwInstl.DefaultSourceInstalling += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object; mwInstl.DefaultSourceInstalled += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object; mwInstl.Completed += mocks.InOrder<Action<MachineWideProcessResults>>(order, m => m.Setup(_ => _(It.IsAny<MachineWideProcessResults>()))).Object; var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.Install(mwInstl); // Assert mocks.VerifyAll(); }
public void Install_should_register_profiler() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var mwInstl = new MachineWideInstallation("2.0.0"); fixture.FreezeUninstalledEnvironment(); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; { var m = fixture.Freeze<Mock<IEnvironmentRepository>>(); m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs); m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView)).Returns(RegistryKeyMixin.DummyX86ClassesRootKey); m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(RegistryKeyMixin.DummyX86InProcServer32Key); m.Setup(_ => _.GetRegistryValue(RegistryKeyMixin.DummyX86InProcServer32Key, null)).Returns(fixture.Create<string>()); } { var m = fixture.Freeze<Mock<IRegsvr32Executor>>(); m.Setup(_ => _.StartInstalling(profLocs[0].PathOfInstalling)).ReturnsUsingFixture(fixture); m.Setup(_ => _.StartInstalling(profLocs[1].PathOfInstalling)).ReturnsUsingFixture(fixture); } var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.Install(mwInstl); // Assert fixture.Freeze<Mock<IRegsvr32Executor>>().VerifyAll(); { var m = fixture.Freeze<Mock<IEnvironmentRepository>>(); m.Verify(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView), Times.Once()); m.Verify(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path), Times.Once()); } }
public void Install_should_raise_the_event_to_register_profiler_before_and_after() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var mwInstl = new MachineWideInstallation("2.0.0"); fixture.FreezeUninstalledEnvironment(); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; { var m = fixture.Freeze<Mock<IEnvironmentRepository>>(); m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs); m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView)).Returns(RegistryKeyMixin.DummyX86ClassesRootKey); m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(RegistryKeyMixin.DummyX86InProcServer32Key); m.Setup(_ => _.GetRegistryValue(RegistryKeyMixin.DummyX86InProcServer32Key, null)).Returns(fixture.Create<string>()); m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[1].RegistryView)).Returns(RegistryKeyMixin.DummyX64ClassesRootKey); m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX64ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(RegistryKeyMixin.DummyX64InProcServer32Key); m.Setup(_ => _.GetRegistryValue(RegistryKeyMixin.DummyX64InProcServer32Key, null)).Returns(fixture.Create<string>()); } var stdouts = fixture.CreateMany<string>(2).ToArray(); { var m = fixture.Freeze<Mock<IRegsvr32Executor>>(); m.Setup(_ => _.StartInstalling(profLocs[0].PathOfInstalling)).Returns(stdouts[0]); m.Setup(_ => _.StartInstalling(profLocs[1].PathOfInstalling)).Returns(stdouts[1]); } var mocks = new MockRepository(MockBehavior.Strict); var order1 = new MockOrder(); var order2 = new MockOrder(); mwInstl.ProfilerRegistering += mocks.Create<Action<ProfilerLocation>>(). InOrder(order1, m => m.Setup(_ => _(profLocs[0]))). InOrder(order2, m => m.Setup(_ => _(profLocs[1]))).Object; mwInstl.ProfilerRegistered += mocks.Create<Action<string>>(). InOrder(order1, m => m.Setup(_ => _(stdouts[0]))). InOrder(order2, m => m.Setup(_ => _(stdouts[1]))).Object; var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.Install(mwInstl); // Assert mocks.VerifyAll(); }
public void HasBeenInstalled_should_raise_the_checking_event_even_if_profiler_has_not_registered_yet() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var machinePreq = new MachinePrerequisite("2.0.0"); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()) }; { var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict); m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs); m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView)).Returns(RegistryKeyMixin.DummyX86ClassesRootKey); m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(default(RegistryKey)); fixture.Inject(m); } { var m = new Mock<Action<ProfilerLocation>>(MockBehavior.Strict); m.Setup(_ => _(profLocs[0])); fixture.Inject(m); machinePreq.ProfilerStatusChecking += m.Object; } var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.HasBeenInstalled(machinePreq); // Assert fixture.Freeze<Mock<Action<ProfilerLocation>>>().VerifyAll(); }
static TestCaseData should_return_false_if_there_is_mismatch_between_registered_profilers_x86() { var fixture = new Fixture().Customize(new AutoMoqCustomization()); var machinePreq = new MachinePrerequisite("2.0.0"); { var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; var DoesNotCall = ParameterForHasBeenInstalled.DoesNotCall; var @params = new[] { new ParameterForHasBeenInstalled() { RegistryView = profLocs[0].RegistryView, ClassesRootKey = RegistryKeyMixin.DummyX86ClassesRootKey, InProcServer32Key = RegistryKeyMixin.DummyX86InProcServer32Key, ProfilerPath = @"C:\Users\Akira\AppData\Local\Microsoft\VisualStudio\12.0\Extensions\jvtxkz2r.sld\tools\x86\Urasandesu.Prig.dll", ProfilerExistence = true, ProfilerFileDescription = "Prig Profiler 1.0.0 Type Library" }, new ParameterForHasBeenInstalled() { SetupOpenRegistryBaseKey = DoesNotCall, SetupOpenRegistrySubKey = DoesNotCall, SetupGetRegistryValue = DoesNotCall, SetupExistsFile = DoesNotCall, SetupGetFileDescription = DoesNotCall } }; fixture.Inject(MockEnvironmentRepository(profLocs, @params)); } return new TestCaseData(machinePreq, fixture).Returns(false).SetName("should_return_false_if_there_is_mismatch_between_registered_profilers_x86"); }
static TestCaseData should_return_false_if_profiler_is_not_registered_to_regstry() { var fixture = new Fixture().Customize(new AutoMoqCustomization()); var machinePreq = new MachinePrerequisite("2.0.0"); { var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; var DoesNotCall = ParameterForHasBeenInstalled.DoesNotCall; var @params = new[] { new ParameterForHasBeenInstalled() { RegistryView = profLocs[0].RegistryView, ClassesRootKey = RegistryKeyMixin.DummyX86ClassesRootKey, InProcServer32Key = null, SetupGetRegistryValue = DoesNotCall, SetupExistsFile = DoesNotCall, SetupGetFileDescription = DoesNotCall }, new ParameterForHasBeenInstalled() { SetupOpenRegistryBaseKey = DoesNotCall, SetupOpenRegistrySubKey = DoesNotCall, SetupGetRegistryValue = DoesNotCall, SetupExistsFile = DoesNotCall, SetupGetFileDescription = DoesNotCall } }; fixture.Inject(MockEnvironmentRepository(profLocs, @params)); } return new TestCaseData(machinePreq, fixture).Returns(false).SetName("should_return_false_if_profiler_is_not_registered_to_regstry"); }
public void Uninstall_should_raise_the_event_to_unregister_profiler_before_and_after() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var mwUninstl = new MachineWideUninstallation("2.0.0"); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; fixture.FreezeInstalledEnvironment(profLocs); var stdouts = fixture.CreateMany<string>(2).ToArray(); { var m = fixture.Freeze<Mock<IRegsvr32Executor>>(); m.Setup(_ => _.StartUninstalling(profLocs[0].PathOfInstalling)).Returns(stdouts[0]); m.Setup(_ => _.StartUninstalling(profLocs[1].PathOfInstalling)).Returns(stdouts[1]); } var mocks = new MockRepository(MockBehavior.Strict); var order1 = new MockOrder(); var order2 = new MockOrder(); mwUninstl.ProfilerUnregistering += mocks.Create<Action<ProfilerLocation>>(). InOrder(order1, m => m.Setup(_ => _(profLocs[0]))). InOrder(order2, m => m.Setup(_ => _(profLocs[1]))).Object; mwUninstl.ProfilerUnregistered += mocks.Create<Action<string>>(). InOrder(order1, m => m.Setup(_ => _(stdouts[0]))). InOrder(order2, m => m.Setup(_ => _(stdouts[1]))).Object; var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.Uninstall(mwUninstl); // Assert mocks.VerifyAll(); }
public void Uninstall_should_unregister_profiler() { // Arrange var fixture = new Fixture().Customize(new AutoMoqCustomization()); var mwUninstl = new MachineWideUninstallation("2.0.0"); var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()), new ProfilerLocation(RegistryView.Registry64, fixture.Create<string>()) }; fixture.FreezeInstalledEnvironment(profLocs); { var m = fixture.Freeze<Mock<IRegsvr32Executor>>(); m.Setup(_ => _.StartUninstalling(profLocs[0].PathOfInstalling)).ReturnsUsingFixture(fixture); m.Setup(_ => _.StartUninstalling(profLocs[1].PathOfInstalling)).ReturnsUsingFixture(fixture); } var mwInstllr = fixture.NewMachineWideInstaller(); // Act mwInstllr.Uninstall(mwUninstl); // Assert fixture.Freeze<Mock<IRegsvr32Executor>>().VerifyAll(); }