19 references to GetVariable
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (19)
ScriptTests.cs (19)
407
Assert.Equal(3m, state.
GetVariable
("a").Value);
408
Assert.Equal(2u, state.
GetVariable
("b").Value);
409
Assert.Equal(5m, state.
GetVariable
("x").Value);
410
Assert.Equal(20, state.
GetVariable
("X").Value);
412
Assert.Null(state.
GetVariable
("A"));
413
Assert.Same(state.
GetVariable
("X"), state.
GetVariable
("X"));
422
s1.
GetVariable
("x").Value = 2;
423
Assert.Equal(2, s1.
GetVariable
("x").Value);
427
Assert.Equal(1, s2.
GetVariable
("x").Value);
431
Assert.Equal(2, s3.
GetVariable
("x").Value);
444
Assert.False(state.
GetVariable
("x").IsReadOnly);
445
Assert.True(state.
GetVariable
("y").IsReadOnly);
446
Assert.True(state.
GetVariable
("z").IsReadOnly);
448
Assert.Throws<ArgumentException>(() => state.
GetVariable
("x").Value = "str");
449
Assert.Throws<InvalidOperationException>(() => state.
GetVariable
("y").Value = "str");
450
Assert.Throws<InvalidOperationException>(() => state.
GetVariable
("z").Value = "str");
451
Assert.Throws<InvalidOperationException>(() => state.
GetVariable
("y").Value = 0);
452
Assert.Throws<InvalidOperationException>(() => state.
GetVariable
("z").Value = 0);