本文整理汇总了C#中Moq.MockRepository.InOrder方法的典型用法代码示例。如果您正苦于以下问题:C# MockRepository.InOrder方法的具体用法?C# MockRepository.InOrder怎么用?C# MockRepository.InOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Moq.MockRepository
的用法示例。
在下文中一共展示了MockRepository.InOrder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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();
}
示例3: 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 mwInstl = new MachineWideInstallation("2.0.0");
fixture.FreezeUninstalledEnvironment();
var profLocs = new[] { new ProfilerLocation(RegistryView.Registry32, fixture.Create<string>()) };
{
var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
m.Setup(_ => _.GetProfilerLocations()).Returns(profLocs);
m.Setup(_ => _.OpenRegistryBaseKey(RegistryHive.ClassesRoot, profLocs[0].RegistryView)).Returns(RegistryKeyMixin.DummyX86ClassesRootKey);
m.Setup(_ => _.OpenRegistrySubKey(RegistryKeyMixin.DummyX86ClassesRootKey, ProfilerLocation.InprocServer32Path)).Returns(RegistryKeyMixin.DummyX86InProcServer32Key);
m.Setup(_ => _.GetRegistryValue(RegistryKeyMixin.DummyX86InProcServer32Key, null)).Returns(fixture.Create<string>());
}
var mocks = new MockRepository(MockBehavior.Strict);
var order = new MockOrder();
mwInstl.Preparing += mocks.InOrder<Action>(order, m => m.Setup(_ => _())).Object;
mwInstl.ProfilerStatusChecking += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object;
mwInstl.NuGetPackageCreating += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
mwInstl.NuGetPackageCreated += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
mwInstl.NuGetSourceRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object;
mwInstl.NuGetSourceRegistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
mwInstl.EnvironmentVariableRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object;
mwInstl.EnvironmentVariableRegistered += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object;
mwInstl.ProfilerRegistering += mocks.InOrder<Action<ProfilerLocation>>(order, m => m.Setup(_ => _(It.IsAny<ProfilerLocation>()))).Object;
mwInstl.ProfilerRegistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
mwInstl.DefaultSourceInstalling += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(It.IsAny<string>(), It.IsAny<string>()))).Object;
mwInstl.DefaultSourceInstalled += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(It.IsAny<string>()))).Object;
mwInstl.Completed += mocks.InOrder<Action<MachineWideProcessResults>>(order, m => m.Setup(_ => _(It.IsAny<MachineWideProcessResults>()))).Object;
var mwInstllr = fixture.NewMachineWideInstaller();
// Act
mwInstllr.Install(mwInstl);
// Assert
mocks.VerifyAll();
}
示例4: Install_should_raise_the_event_to_register_environment_variables_before_and_after
public void Install_should_raise_the_event_to_register_environment_variables_before_and_after()
{
// Arrange
var fixture = new Fixture().Customize(new AutoMoqCustomization());
var mwInstl = new MachineWideInstallation("2.0.0");
fixture.FreezeUninstalledEnvironment();
var pkgDir = @"C:\ProgramData\chocolatey\lib\Prig";
var variableName = "URASANDESU_PRIG_PACKAGE_FOLDER";
var variableValue = pkgDir;
{
var m = fixture.Freeze<Mock<IEnvironmentRepository>>();
m.Setup(_ => _.GetPackageFolder()).Returns(pkgDir);
m.Setup(_ => _.GetPackageFolderKey()).Returns(variableName);
m.Setup(_ => _.StorePackageFolder(variableValue));
}
var mocks = new MockRepository(MockBehavior.Strict);
var order = new MockOrder();
mwInstl.EnvironmentVariableRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(variableName, variableValue))).Object;
mwInstl.EnvironmentVariableRegistered += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _(variableName, variableValue))).Object;
var mwInstllr = fixture.NewMachineWideInstaller();
// Act
mwInstllr.Install(mwInstl);
// Assert
mocks.VerifyAll();
}
示例5: Install_should_raise_the_event_to_register_NuGet_source_before_and_after
public void Install_should_raise_the_event_to_register_NuGet_source_before_and_after()
{
// Arrange
var fixture = new Fixture().Customize(new AutoMoqCustomization());
var mwInstl = new MachineWideInstallation("2.0.0");
var toolsPath = @"C:\ProgramData\chocolatey\lib\Prig\tools";
fixture.FreezeUninstalledEnvironment(toolsPath);
var stdout = fixture.Create<string>();
{
var m = fixture.Freeze<Mock<INuGetExecutor>>();
m.Setup(_ => _.StartSourcing(It.IsAny<string>(), It.IsAny<string>())).Returns(stdout);
}
var mocks = new MockRepository(MockBehavior.Strict);
var order = new MockOrder();
mwInstl.NuGetSourceRegistering += mocks.InOrder<Action<string, string>>(order, m => m.Setup(_ => _("Prig Source", toolsPath))).Object;
mwInstl.NuGetSourceRegistered += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(stdout))).Object;
var mwInstllr = fixture.NewMachineWideInstaller();
// Act
mwInstllr.Install(mwInstl);
// Assert
mocks.VerifyAll();
}
示例6: Install_should_raise_the_event_to_create_Nupkg_before_and_after
public void Install_should_raise_the_event_to_create_Nupkg_before_and_after()
{
// Arrange
var fixture = new Fixture().Customize(new AutoMoqCustomization());
var mwInstl = new MachineWideInstallation("2.0.0");
fixture.FreezeUninstalledEnvironment();
var stdout = fixture.Create<string>();
{
var m = fixture.Freeze<Mock<INuGetExecutor>>();
m.Setup(_ => _.StartPacking(It.IsAny<string>(), It.IsAny<string>())).Returns(stdout);
}
var mocks = new MockRepository(MockBehavior.Strict);
var order = new MockOrder();
mwInstl.NuGetPackageCreating += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _("Prig"))).Object;
mwInstl.NuGetPackageCreated += mocks.InOrder<Action<string>>(order, m => m.Setup(_ => _(stdout))).Object;
var mwInstllr = fixture.NewMachineWideInstaller();
// Act
mwInstllr.Install(mwInstl);
// Assert
mocks.VerifyAll();
}
示例7: 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();
}