Пример #1
0
        public void ReportProfilerProcessingProgress_should_report_the_progress_to_statusbar(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var prog             = fixture.Create <uint>();
            var pathOfInstalling = fixture.Create <string>();
            var profLoc          = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new PrigViewModel();

            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportProfilerProcessingProgress(prog, profLoc);


            // Assert
            var progState = vm.Statusbar.ProgressState.Value;

            Assert.AreEqual(prog, progState.Value);
            Assert.That(progState.Label, Is.StringMatching(pathOfInstalling));
        }
Пример #2
0
        internal void ReportProfilerProcessingProgress(ProfilerLocation profLoc)
        {
            Debug.Assert(m_mwProc != MachineWideProcesses.None);
            var resName = string.Format("ProcessingProfiler_0_ToRegistry_{0}_MessageFormat", m_mwProc);
            var msg     = string.Format(ConsoleResources.GetString(resName), profLoc.PathOfInstalling);

            Message.Value = msg;
        }
Пример #3
0
        internal void ReportProfilerProcessingProgress(uint prog, ProfilerLocation profLoc)
        {
            Debug.Assert(m_mwProc != MachineWideProcesses.None);
            var resName = string.Format("ProcessingProfiler_0_ToRegistry_{0}_MessageFormat", m_mwProc);
            var msg     = string.Format(PrigResources.GetString(resName), profLoc.PathOfInstalling);

            Statusbar.ReportProgress(msg, prog);
        }
Пример #4
0
        protected internal virtual void OnProfilerStatusChecking(ProfilerLocation profLoc)
        {
            var handler = ProfilerStatusChecking;
            if (handler == null)
                return;

            handler(profLoc);
        }
Пример #5
0
 public static void FreezeInstalledEnvironment(this IFixture fixture, ProfilerLocation[] profLocs)
 {
     var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
     m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs);
     m.Setup(_ => _.OpenRegistryBaseKey(It.IsAny<RegistryHive>(), It.IsAny<RegistryView>())).Returns(RegistryKeyMixin.DummyX86ClassesRootKey);
     m.Setup(_ => _.OpenRegistrySubKey(It.IsAny<RegistryKey>(), It.IsAny<string>())).Returns(RegistryKeyMixin.DummyX86InProcServer32Key);
     m.Setup(_ => _.GetRegistryValue(It.IsAny<RegistryKey>(), It.IsAny<string>())).Returns(fixture.Create<string>());
     m.Setup(_ => _.ExistsFile(It.IsAny<string>())).Returns(true);
     m.Setup(_ => _.GetFileDescription(It.IsAny<string>())).Returns("Prig Profiler 2.0.0 Type Library");
 }
Пример #6
0
        public void ReportProfilerStatusCheckingProgress_should_report_the_progress()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var pathOfInstalling = fixture.Create <string>();
            var profLoc          = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new ConsoleViewModel();

            // Act
            vm.ReportProfilerStatusCheckingProgress(profLoc);


            // Assert
            Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling));
        }
Пример #7
0
        public void ReportProfilerProcessingProgress_should_report_the_progress(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var pathOfInstalling = fixture.Create <string>();
            var profLoc          = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new ConsoleViewModel();

            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportProfilerProcessingProgress(profLoc);


            // Assert
            Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling));
        }
Пример #8
0
        internal void ReportProfilerStatusCheckingProgress(uint prog, ProfilerLocation profLoc)
        {
            var msg = string.Format(PrigResources.GetString("CheckingInstallationStatusForProfiler_0_MessageFormat"), profLoc.PathOfInstalling);

            Statusbar.ReportProgress(msg, prog);
        }
Пример #9
0
 internal void ReportProfilerStatusCheckingProgress(uint prog, ProfilerLocation profLoc)
 {
     var msg = string.Format(PrigResources.GetString("CheckingInstallationStatusForProfiler_0_MessageFormat"), profLoc.PathOfInstalling);
     Statusbar.ReportProgress(msg, prog);
 }
Пример #10
0
 internal void ReportProfilerProcessingProgress(uint prog, ProfilerLocation profLoc)
 {
     Debug.Assert(m_mwProc != MachineWideProcesses.None);
     var resName = string.Format("ProcessingProfiler_0_ToRegistry_{0}_MessageFormat", m_mwProc);
     var msg = string.Format(PrigResources.GetString(resName), profLoc.PathOfInstalling);
     Statusbar.ReportProgress(msg, prog);
 }
Пример #11
0
        public void ReportProfilerStatusCheckingProgress_should_report_the_progress()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var pathOfInstalling = fixture.Create<string>();
            var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new ConsoleViewModel();

            // Act
            vm.ReportProfilerStatusCheckingProgress(profLoc);

            // Assert
            Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling));
        }
Пример #12
0
 static TestCaseData should_return_false_if_profiler_locations_are_empty()
 {
     var fixture = new Fixture().Customize(new AutoMoqCustomization());
     var machinePreq = new MachinePrerequisite("2.0.0");
     {
         var profLocs = new ProfilerLocation[0];
         var @params = new ParameterForHasBeenInstalled[0];
         fixture.Inject(MockEnvironmentRepository(profLocs, @params));
     }
     return new TestCaseData(machinePreq, fixture).Returns(false).SetName("should_return_false_if_profiler_locations_are_empty");
 }
Пример #13
0
 protected internal virtual void OnProfilerStatusChecking(ProfilerLocation profLoc)
 {
     Prerequisite.OnProfilerStatusChecking(profLoc);
 }
Пример #14
0
        internal void ReportProfilerStatusCheckingProgress(ProfilerLocation profLoc)
        {
            var msg = string.Format(ConsoleResources.GetString("CheckingInstallationStatusForProfiler_0_MessageFormat"), profLoc.PathOfInstalling);

            Message.Value = msg;
        }
Пример #15
0
        public void ReportProfilerProcessingProgress_should_report_the_progress_to_statusbar(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var prog = fixture.Create<uint>();
            var pathOfInstalling = fixture.Create<string>();
            var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new PrigPackageViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportProfilerProcessingProgress(prog, profLoc);


            // Assert
            var progState = vm.Statusbar.ProgressState.Value;
            Assert.AreEqual(prog, progState.Value);
            Assert.That(progState.Label, Is.StringMatching(pathOfInstalling));
        }
Пример #16
0
        public void Install_should_not_register_profiler_if_profiler_locations_are_empty()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwInstl = new MachineWideInstallation("2.0.0");
            fixture.FreezeUninstalledEnvironment();
            var profLocs = new ProfilerLocation[0];
            {
                var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
                m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs);
            }
            fixture.Inject(new Mock<IRegsvr32Executor>());

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Install(mwInstl);


            // Assert
            {
                var m = fixture.Freeze<Mock<IRegsvr32Executor>>();
                m.Verify(_ => _.StartInstalling(It.IsAny<string>()), Times.Never());
            }
        }
Пример #17
0
 static Mock<IEnvironmentRepository> MockEnvironmentRepository(ProfilerLocation[] profLocs, ParameterForHasBeenInstalled[] @params)
 {
     var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
     m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs);
     foreach (var param in @params)
     {
         param.SetupOpenRegistryBaseKey(m, param);
         param.SetupOpenRegistrySubKey(m, param);
         param.SetupGetRegistryValue(m, param);
         param.SetupExistsFile(m, param);
         param.SetupGetFileDescription(m, param);
     }
     return m;
 }
Пример #18
0
        public void ReportProfilerProcessingProgress_should_report_the_progress(
            [Values(MachineWideProcesses.Installing, MachineWideProcesses.Uninstalling)]
            MachineWideProcesses mwProc)
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var pathOfInstalling = fixture.Create<string>();
            var profLoc = new ProfilerLocation(RegistryView.Registry64, pathOfInstalling);

            var vm = new ConsoleViewModel();
            vm.BeginMachineWideProcessProgress(mwProc);

            // Act
            vm.ReportProfilerProcessingProgress(profLoc);

            // Assert
            Assert.That(vm.Message.Value, Is.StringMatching(pathOfInstalling));
        }
Пример #19
0
        protected internal virtual void OnProfilerUnregistering(ProfilerLocation profLoc)
        {
            var handler = ProfilerUnregistering;
            if (handler == null)
                return;

            handler(profLoc);
        }