本文整理汇总了C#中Variable.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Variable.SetValue方法的具体用法?C# Variable.SetValue怎么用?C# Variable.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Variable
的用法示例。
在下文中一共展示了Variable.SetValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Double_Variable_Value_Set
public void Test_Double_Variable_Value_Set()
{
Variable<double> testVar = new Variable<double>("testVar", default(double), false);
testVar.SetValue(11.15623);
double value = testVar.Value;
Assert.AreEqual(11.15623, value, "Value setter does not work properly.<Double>");
}
示例2: Test_Integer_Variable_Value_Set
public void Test_Integer_Variable_Value_Set()
{
Variable<int> testVar = new Variable<int>("testVar", default(int), false);
testVar.SetValue(14);
int value = testVar.Value;
Assert.AreEqual(14, value, "Value setter does not work properly.<Integer>");
}
示例3: Test_String_Variable_Value_Set
public void Test_String_Variable_Value_Set()
{
Variable<string> testVar = new Variable<string>("testVar", string.Empty, false);
testVar.SetValue("Nanyo");
string value = testVar.Value;
Assert.AreEqual("Nanyo", value, "Value setter does not work properly.<String>");
}
示例4: ShouldCopyExpressionsToValue
public void ShouldCopyExpressionsToValue()
{
var target = new Variable("x");
var ex1 = new Expression(2, Variable.NULL);
var ex2 = new Expression(3, new Variable("y"));
target.SetValue(new List<Expression>() {ex2, ex1});
ex1.Coefficient = 0;
ex2.Coefficient = 1;
Assert.AreEqual(2, target.Value.First(x => x.Variable.Equals(Variable.NULL)).Coefficient);
Assert.AreEqual(3, target.Value.First(x => x.Variable.Name == "y").Coefficient);
}