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


C# ApplicationManager.Initialize方法代码示例

本文整理汇总了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);
        }
开发者ID:Geminior,项目名称:DeepConfig,代码行数:17,代码来源:ApplicationManagerTests.cs

示例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);
        }
开发者ID:Geminior,项目名称:DeepConfig,代码行数:22,代码来源:ApplicationManagerTests.cs

示例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();
        }
开发者ID:Geminior,项目名称:DeepConfig,代码行数:23,代码来源:ApplicationManagerTests.cs

示例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();
        }
开发者ID:Geminior,项目名称:DeepConfig,代码行数:16,代码来源:ApplicationManagerTests.cs


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