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


C# Fixture.NewPrigExecutor方法代码示例

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


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

示例1: StartInstalling_should_do_nothing_if_it_will_be_executed_after_the_2nd_time

        public void StartInstalling_should_do_nothing_if_it_will_be_executed_after_the_2nd_time()
        {
            using (var prigConfig = new FileInfo(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\Prig.config")).BeginModifying())
            {
                try
                {
                    // Arrange
                    prigConfig.Info.Delete();
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", AppDomain.CurrentDomain.BaseDirectory);

                    var fixture = new Fixture().Customize(new AutoMoqCustomization());
                    {
                        var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
                        m.Setup(_ => _.GetPrigPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\prig.exe"));
                        fixture.Inject(m);
                    }

                    var source = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString("N"));
                    Directory.CreateDirectory(source);

                    var prigExecutor = fixture.NewPrigExecutor();

                    // Act
                    prigExecutor.StartInstalling("TestWindow", source);
                    var result = prigExecutor.StartInstalling("TestWindow", source);

                    // Assert
                    Assert.That(result, Is.StringMatching(@"The specified source:.* has already installed\."));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", null);
                }
            }
        }
开发者ID:urasandesu,项目名称:Prig,代码行数:35,代码来源:PrigExecutorTest.cs

示例2: StartInstalling_should_install_specified_source

        public void StartInstalling_should_install_specified_source()
        {
            using (var prigConfig = new FileInfo(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\Prig.config")).BeginModifying())
            {
                try
                {
                    // Arrange
                    prigConfig.Info.Delete();
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", AppDomain.CurrentDomain.BaseDirectory);

                    var fixture = new Fixture().Customize(new AutoMoqCustomization());
                    {
                        var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
                        m.Setup(_ => _.GetPrigPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\prig.exe"));
                        fixture.Inject(m);
                    }

                    var source = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString("N"));
                    Directory.CreateDirectory(source);

                    var prigExecutor = fixture.NewPrigExecutor();
                    

                    // Act
                    var result = prigExecutor.StartInstalling("TestWindow", source);


                    // Assert
                    Assert.IsEmpty(result);
                    Assert.AreEqual(6, Directory.GetFiles(source).Length);
                }
                finally
                {
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", null);
                }
            }
        }
开发者ID:umaranis,项目名称:Prig,代码行数:37,代码来源:PrigExecutorTest.cs

示例3: StartUninstalling_should_do_nothing_if_it_has_not_installed_yet

        public void StartUninstalling_should_do_nothing_if_it_has_not_installed_yet()
        {
            using (var prigConfig = new FileInfo(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\Prig.config")).BeginModifying())
            {
                try
                {
                    // Arrange
                    prigConfig.Info.Delete();
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", AppDomain.CurrentDomain.BaseDirectory);

                    var fixture = new Fixture().Customize(new AutoMoqCustomization());
                    {
                        var m = new Mock<IEnvironmentRepository>(MockBehavior.Strict);
                        m.Setup(_ => _.GetPrigPath()).Returns(AppDomain.CurrentDomain.GetPathInBaseDirectory(@"tools\prig.exe"));
                        fixture.Inject(m);
                    }

                    var source = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid().ToString("N"));
                    Directory.CreateDirectory(source);

                    var prigExecutor = fixture.NewPrigExecutor();


                    // Act
                    var result = prigExecutor.StartUninstalling("All");


                    // Assert
                    Assert.That(result, Is.StringMatching(@"The specified package:.* is not found. It might have been already uninstalled."));
                    CollectionAssert.IsEmpty(Directory.GetFiles(source));
                }
                finally
                {
                    Environment.SetEnvironmentVariable("URASANDESU_PRIG_PACKAGE_FOLDER", null);
                }
            }
        }
开发者ID:umaranis,项目名称:Prig,代码行数:37,代码来源:PrigExecutorTest.cs


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