コード例 #1
0
        public void GetCurrentProjectOrException_should_throw_InvalidOperationException_if_it_is_not_set()
        {
            // Arrange
            var vm = new PrigPackageViewModel();
            vm.CurrentProject.Value = null;


            // Act, Assert
            Assert.Throws<InvalidOperationException>(() => vm.GetCurrentProjectOrException());
        }
コード例 #2
0
        bool EnableTestAdapterCore(PrigPackageViewModel vm)
        {
            vm.BeginProjectWideProcessProgress(ProjectWideProcesses.TestAdapterEnabling);


            var machinePreq = new MachinePrerequisite(Resources.NuGetRootPackageVersion);
            machinePreq.ProfilerStatusChecking += profLoc => vm.ReportProfilerStatusCheckingProgress(25u, profLoc);
            if (!MachineWideInstaller.HasBeenInstalled(machinePreq))
            {
                vm.ShowSkippedProjectWideProcessMessage(SkippedReasons.NotRegisteredYet, null);
                vm.EndSkippedProjectWideProcessProgress(SkippedReasons.NotRegisteredYet, null);
                return false;
            }

            
            var proj = vm.GetCurrentProjectOrException();


            var command =
@"
Import-Module ([IO.Path]::Combine($env:URASANDESU_PRIG_PACKAGE_FOLDER, 'tools\Urasandesu.Prig'))
Enable-PrigTestAdapter -Project $Project
";
            var mci = new ManagementCommandInfo(command, proj);
            mci.CommandExecuting += () => vm.ReportProcessingProjectWideProcessProgress(50u, proj.Name);
            mci.CommandExecuted += () => vm.EndCompletedProjectWideProcessProgress(proj.Name);
            ManagementCommandExecutor.Execute(mci);

            return true;
        }
コード例 #3
0
        public void GetCurrentProjectOrException_should_return_current_project_if_it_is_set()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());
            var curProj = default(Project);
            {
                var m = new Mock<Project>(MockBehavior.Strict);
                curProj = m.Object;
                fixture.Inject(m);
            }

            var vm = new PrigPackageViewModel();
            vm.CurrentProject.Value = curProj;


            // Act
            var result = vm.GetCurrentProjectOrException();


            // Assert
            Assert.AreSame(curProj, result);
        }