本文整理汇总了C#中ApplicationManager.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ApplicationManager.Initialize方法的具体用法?C# ApplicationManager.Initialize怎么用?C# ApplicationManager.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApplicationManager
的用法示例。
在下文中一共展示了ApplicationManager.Initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize_with_command_arg_should_return_null
public void Initialize_with_command_arg_should_return_null()
{
/* Arrange */
var mocks = new TestAssistant().MockAll();
var mgr = new ApplicationManager(mocks.ActionsManager);
A.CallTo(() => mocks.ActionsManager.ExecuteCommandLine(A<string[]>.Ignored)).Returns(true);
/* Act */
var a = mgr.Initialize(mocks.Container, new string[] { "MustHaveAtleastOneArg" });
/* Assert */
a.Should().BeNull();
A.CallTo(() => mocks.ActionsManager.BuildActions(A<IEnumerable<IProvideActions>>.Ignored)).MustNotHaveHappened();
A.CallTo(() => mocks.ActionsManager.ExecuteCommandLine(A<string[]>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
}
示例2: Initialize_with_file_arg_should_go_to_request_display_of_config
public void Initialize_with_file_arg_should_go_to_request_display_of_config()
{
/* Arrange */
var mocks = new TestAssistant().MockAll();
var mgr = new ApplicationManager(mocks.ActionsManager);
ConfigRequest msg = null;
A.CallTo(() => mocks.Messenger.Publish(A<object>.Ignored)).Invokes(c => msg = c.Arguments[0] as ConfigRequest);
/* Act */
var a = mgr.Initialize(mocks.Container, new string[] { "SomeFileName" });
a();
/* Assert */
msg.Should().NotBeNull();
msg.RequestedAction.Should().Be(ConfigRequest.Action.Open);
msg.Source.Provider.As<FileConfigProvider>().ConfigFileName.Should().Be("SomeFileName");
A.CallTo(() => mocks.ActionsManager.BuildActions(A<IEnumerable<IProvideActions>>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => mocks.ActionsManager.ExecuteCommandLine(A<string[]>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
}
示例3: Initialize_with_an_existing_plugin_should_find_it_and_load_it
public void Initialize_with_an_existing_plugin_should_find_it_and_load_it()
{
/* Arrange */
var mocks = new TestAssistant().MockAll();
var mgr = new ApplicationManager(mocks.ActionsManager);
PluginConfig.Instance.PluginFolder = "Addins";
/* Act */
var preInit = mocks.Container.TryGet<IProvideConfigSource>();
mgr.Initialize(mocks.Container, new string[0]);
var postInit = mocks.Container.TryGet<IProvideConfigSource>();
/* Assert */
AssemblySource.Instance.Should().ContainSingle(asm => asm.GetAssemblyName() == "SampleEditorPlugin");
A.CallTo(mocks.Logger).MustNotHaveHappened();
//Faking the IKernel doesn't work so instead we check the actual container
preInit.Should().BeNull();
postInit.Should().NotBeNull();
}
示例4: Initialize_with_no_args_should_go_to_source_open
public void Initialize_with_no_args_should_go_to_source_open()
{
/* Arrange */
var mocks = new TestAssistant().MockAll();
var mgr = new ApplicationManager(mocks.ActionsManager);
/* Act */
var a = mgr.Initialize(mocks.Container, new string[0]);
a();
/* Assert */
A.CallTo(() => mocks.Messenger.Publish(A<ConfigSourceRequest>.That.Matches(r => r.RequestPurpose == ConfigSourcePurpose.Open))).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => mocks.ActionsManager.BuildActions(A<IEnumerable<IProvideActions>>.Ignored)).MustHaveHappened(Repeated.Exactly.Once);
A.CallTo(() => mocks.ActionsManager.ExecuteCommandLine(A<string[]>.Ignored)).MustNotHaveHappened();
}