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


C# Fixture.NewProjectWideInstaller方法代码示例

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


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

示例1: Install_should_install_if_a_package_has_not_been_installed_yet

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

            var proj = fixture.Freeze<Project>();
            var pwPkg = new ProjectWidePackage("Prig", "2.0.0", proj);
            var mocks = new MockRepository(MockBehavior.Strict);
            {
                var m = mocks.Create<IVsPackageInstallerServices>();
                m.Setup(_ => _.IsPackageInstalledEx(proj, "Prig", "2.0.0")).Returns(false);
                m.Setup(_ => _.IsPackageInstalled(proj, "Prig")).Returns(false);
                fixture.Inject(m);
            }
            {
                var m = mocks.Create<IVsPackageUninstaller>();
                fixture.Inject(m);
            }
            {
                var m = mocks.Create<IVsPackageInstaller>();
                m.Setup(_ => _.InstallPackage(default(string), proj, "Prig", "2.0.0", false));
                fixture.Inject(m);
            }

            var pwInstllr = fixture.NewProjectWideInstaller();


            // Act
            pwInstllr.Install(pwPkg);


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

示例2: Install_should_call_installation_steps_by_a_fixed_sequence

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

            var proj = fixture.Freeze<Project>();
            var pwPkg = new ProjectWidePackage("Prig", "2.0.0", proj);
            var callback = default(Action);
            var metadataArr = fixture.CreateMany<IVsPackageMetadata>(3).ToArray();
            {
                var m = fixture.Freeze<Mock<IVsPackageInstallerEvents>>();
                callback = () =>
                {
                    m.Raise(_ => _.PackageInstalling += null, metadataArr[0]);
                    m.Raise(_ => _.PackageInstalled += null, metadataArr[1]);
                    m.Raise(_ => _.PackageReferenceAdded += null, metadataArr[2]);
                };
            }
            {
                var m = fixture.Freeze<Mock<IVsPackageInstaller>>();
                m.Setup(_ => _.InstallPackage(It.IsAny<string>(), It.IsAny<Project>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Callback(callback);
            }
            var mocks = new MockRepository(MockBehavior.Strict);
            var order = new MockOrder();
            pwPkg.PackageInstalling += mocks.InOrder<VsPackageEventHandler>(order, m => m.Setup(_ => _(metadataArr[0]))).Object;
            pwPkg.PackageInstalled += mocks.InOrder<VsPackageEventHandler>(order, m => m.Setup(_ => _(metadataArr[1]))).Object;
            pwPkg.PackageReferenceAdded += mocks.InOrder<VsPackageEventHandler>(order, m => m.Setup(_ => _(metadataArr[2]))).Object;

            var pwInstllr = fixture.NewProjectWideInstaller();


            // Act
            pwInstllr.Install(pwPkg);


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


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