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


C# Workspace.GetWorkspaceValue方法代码示例

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


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

示例1: CorrectlyHandlesValuesWithDefaults

            public void CorrectlyHandlesValuesWithDefaults(string configurationKey, bool setValueBeforeRetrieving, object valueToSet, object defaultValue, object expectedValue)
            {
                var workspace = new Workspace();

                if (setValueBeforeRetrieving)
                {
                    workspace.SetConfigurationValue(configurationKey, valueToSet);
                }

                var currentValue = workspace.GetWorkspaceValue(configurationKey, defaultValue);

                Assert.AreEqual(expectedValue, currentValue);
            }
开发者ID:llenroc,项目名称:Orc.WorkspaceManagement,代码行数:13,代码来源:WorkspaceFacts.cs

示例2: SynchronizesWorkspaces

        public void SynchronizesWorkspaces()
        {
            var workspaceA = new Workspace();
            workspaceA.SetWorkspaceValue("A", 1);
            workspaceA.SetWorkspaceValue("B", 2);
            workspaceA.SetWorkspaceValue("C", 3);

            var workspaceB = new Workspace();
            workspaceB.SetWorkspaceValue("D", 4);
            workspaceB.SetWorkspaceValue("E", 5);
            workspaceB.SetWorkspaceValue("F", 6);

            workspaceA.SynchronizeWithWorkspace(workspaceB);

            Assert.AreEqual(0, workspaceA.GetWorkspaceValue("A", 0));
            Assert.AreEqual(0, workspaceA.GetWorkspaceValue("B", 0));
            Assert.AreEqual(0, workspaceA.GetWorkspaceValue("C", 0));
            Assert.AreEqual(4, workspaceA.GetWorkspaceValue("D", 0));
            Assert.AreEqual(5, workspaceA.GetWorkspaceValue("E", 0));
            Assert.AreEqual(6, workspaceA.GetWorkspaceValue("F", 0));
        }
开发者ID:WildGums,项目名称:Orc.WorkspaceManagement,代码行数:21,代码来源:WorkspaceExtensionsFacts.cs

示例3: CorrectlyRemovesProviderWhenStoringWorkspace

            public async Task CorrectlyRemovesProviderWhenStoringWorkspace()
            {
                var workspaceManager = Factories.WorkspaceManager.WithEmptyInitializer();
                var workspace = new Workspace
                {
                    Title = WorkspaceNameHelper.GetRandomWorkspaceName()
                };

                await workspaceManager.AddAsync(workspace, true);

                var workspaceProvider = new WorkspaceProvider("key1", "value1");
                workspaceManager.AddProvider(workspaceProvider);
                workspaceManager.RemoveProvider(workspaceProvider);

                await workspaceManager.StoreWorkspaceAsync();

                Assert.AreEqual("expected", workspace.GetWorkspaceValue("key1", "expected"));
            }
开发者ID:WildGums,项目名称:Orc.WorkspaceManagement,代码行数:18,代码来源:WorkspaceManagerFacts.cs


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