本文整理汇总了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);
}
示例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));
}
示例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"));
}