本文整理汇总了C#中Variables.RecalculateExpanded方法的典型用法代码示例。如果您正苦于以下问题:C# Variables.RecalculateExpanded方法的具体用法?C# Variables.RecalculateExpanded怎么用?C# Variables.RecalculateExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variables
的用法示例。
在下文中一共展示了Variables.RecalculateExpanded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecalculateExpanded_RetainsUpdatedSecretness
public void RecalculateExpanded_RetainsUpdatedSecretness()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
List<string> warnings;
var variables = new Variables(hc, new Dictionary<string, string>(), new List<MaskHint>(), out warnings);
Assert.Equal(0, warnings.Count);
variables.Set("foo", "bar");
Assert.Equal(1, variables.Public.Count());
// Act.
variables.Set("foo", "baz", secret: true);
variables.RecalculateExpanded(out warnings);
// Assert.
Assert.Equal(0, warnings.Count);
Assert.Equal(0, variables.Public.Count());
Assert.Equal("baz", variables.Get("foo"));
}
}
示例2: RecalculateExpanded_PerformsRecalculation
public void RecalculateExpanded_PerformsRecalculation()
{
using (TestHostContext hc = new TestHostContext(this))
{
// Arrange.
List<string> warnings;
var original = new Dictionary<string, string>
{
{ "topLevelVariable", "$(nestedVariable1) $(nestedVariable2)" },
{ "nestedVariable1", "Some nested value 1" },
};
var variables = new Variables(hc, original, new List<MaskHint>(), out warnings);
Assert.Equal(0, warnings.Count);
Assert.Equal(2, variables.Public.Count());
Assert.Equal("Some nested value 1 $(nestedVariable2)", variables.Get("topLevelVariable"));
Assert.Equal("Some nested value 1", variables.Get("nestedVariable1"));
// Act.
variables.Set("nestedVariable2", "Some nested value 2", secret: false);
variables.RecalculateExpanded(out warnings);
// Assert.
Assert.Equal(0, warnings.Count);
Assert.Equal(3, variables.Public.Count());
Assert.Equal("Some nested value 1 Some nested value 2", variables.Get("topLevelVariable"));
Assert.Equal("Some nested value 1", variables.Get("nestedVariable1"));
Assert.Equal("Some nested value 2", variables.Get("nestedVariable2"));
}
}