当前位置: 首页>>代码示例>>C#>>正文


C# Fixture.FreezeInstalledEnvironment方法代码示例

本文整理汇总了C#中Fixture.FreezeInstalledEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C# Fixture.FreezeInstalledEnvironment方法的具体用法?C# Fixture.FreezeInstalledEnvironment怎么用?C# Fixture.FreezeInstalledEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fixture的用法示例。


在下文中一共展示了Fixture.FreezeInstalledEnvironment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Install_should_raise_the_events_for_the_installation_steps_if_skipped

        public void Install_should_raise_the_events_for_the_installation_steps_if_skipped()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwInstl = new MachineWideInstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            var mocks = new MockRepository(MockBehavior.Strict);
            var order = new MockOrder();
            mwInstl.Completed += mocks.InOrder<Action<MachineWideProcessResults>>(order, m => m.Setup(_ => _(MachineWideProcessResults.Skipped))).Object;


            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Install(mwInstl);


            // Assert
            mocks.VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:22,代码来源:MachineWideInstallerTest.cs

示例2: Uninstall_should_call_uninstallation_steps_by_a_fixed_sequence

        public void Uninstall_should_call_uninstallation_steps_by_a_fixed_sequence()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            var mocks = new MockRepository(MockBehavior.Strict);
            var order = new MockOrder();
            mwUninstl.Preparing += mocks.InOrder<Action>(order, m => m.Setup(_ => _())).Object;
            mwUninstl.ProfilerStatusChecking += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object;
            mwUninstl.DefaultSourceUninstalling += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.DefaultSourceUninstalled += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.ProfilerUnregistering += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object;
            mwUninstl.ProfilerUnregistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.EnvironmentVariableUnregistering += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.EnvironmentVariableUnregistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.NuGetSourceUnregistering += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.NuGetSourceUnregistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
            mwUninstl.Completed += mocks.InOrder<Action<MachineWideProcessResults>>(order, m => m.Setup(_ => _(It.IsAny<MachineWideProcessResults>()))).Object;

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            mocks.VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:31,代码来源:MachineWideInstallerTest.cs

示例3: Install_should_skip_installation_if_it_has_been_already_installed

        public void Install_should_skip_installation_if_it_has_been_already_installed()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwInstl = new MachineWideInstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            fixture.Inject(new Mock<INuGetExecutor>(MockBehavior.Strict));
            fixture.Inject(new Mock<IRegsvr32Executor>(MockBehavior.Strict));
            fixture.Inject(new Mock<IPrigExecutor>(MockBehavior.Strict));

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act, Assert
            mwInstllr.Install(mwInstl);
        }
开发者ID:umaranis,项目名称:Prig,代码行数:17,代码来源:MachineWideInstallerTest.cs

示例4: Uninstall_should_raise_the_event_to_unregister_NuGet_source_before_and_after

        public void Uninstall_should_raise_the_event_to_unregister_NuGet_source_before_and_after()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            var stdout = fixture.Create<string>();
            {
                var m = fixture.Freeze<Mock<INuGetExecutor>>();
                m.Setup(_ => _.StartUnsourcing(It.IsAny<string>())).Returns(stdout);
            }
            var mocks = new MockRepository(MockBehavior.Strict);
            var order = new MockOrder();
            mwUninstl.NuGetSourceUnregistering += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _("Prig Source"))).Object;
            mwUninstl.NuGetSourceUnregistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(stdout))).Object;

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            mocks.VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:27,代码来源:MachineWideInstallerTest.cs

示例5: Uninstall_should_unregister_package_folder

        public void Uninstall_should_unregister_package_folder()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            {
                var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
                m.Setup(_ => _.UnregisterPackageFolder()).Verifiable();
            }

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            fixture.Freeze<Mock<IEnvironmentRepository>>().Verify();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:22,代码来源:MachineWideInstallerTest.cs

示例6: Uninstall_should_unregister_NuGet_source

        public void Uninstall_should_unregister_NuGet_source()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            {
                var name = @"Prig Source";
                var m = fixture.Freeze<Mock<INuGetExecutor>>();
                m.Setup(_ => _.StartUnsourcing(name)).Returns(fixture.Create<string>());
            }

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            fixture.Freeze<Mock<INuGetExecutor>>().VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:23,代码来源:MachineWideInstallerTest.cs

示例7: Uninstall_should_raise_the_event_to_unregister_environment_variables_before_and_after

        public void Uninstall_should_raise_the_event_to_unregister_environment_variables_before_and_after()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            var variableName = "URASANDESU_PRIG_PACKAGE_FOLDER";
            {
                var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
                m.Setup(_ => _.GetPackageFolderKey()).Returns(variableName);
            }
            var mocks = new MockRepository(MockBehavior.Strict);
            var order = new MockOrder();
            mwUninstl.EnvironmentVariableUnregistering += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(variableName))).Object;
            mwUninstl.EnvironmentVariableUnregistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(variableName))).Object;

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            mocks.VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:27,代码来源:MachineWideInstallerTest.cs

示例8: Uninstall_should_raise_the_event_to_unregister_profiler_before_and_after

        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();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:41,代码来源:MachineWideInstallerTest.cs

示例9: Uninstall_should_unregister_profiler

        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();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:29,代码来源:MachineWideInstallerTest.cs

示例10: Uninstall_should_uninstall_all_sources

        public void Uninstall_should_uninstall_all_sources()
        {
            // Arrange
            var fixture = new Fixture().Customize(new AutoMoqCustomization());

            var mwUninstl = new MachineWideUninstallation("2.0.0");
            fixture.FreezeInstalledEnvironment();
            {
                var m = fixture.Freeze<Mock<IPrigExecutor>>();
                m.Setup(_ => _.StartUninstalling("All")).ReturnsUsingFixture(fixture);
            }

            var mwInstllr = fixture.NewMachineWideInstaller();


            // Act
            mwInstllr.Uninstall(mwUninstl);


            // Assert
            fixture.Freeze<Mock<IPrigExecutor>>().VerifyAll();
        }
开发者ID:umaranis,项目名称:Prig,代码行数:22,代码来源:MachineWideInstallerTest.cs


注:本文中的Fixture.FreezeInstalledEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。