コード例 #1
0
        private void TestInputGeneric(CosmosTypedValue expected)
        {
            //Arrange
            var variable = new CosmosVariable("#input", null);

            BuildSnippetInterpreter(BuildAllocationSnippet(variable) +
                                    BuildInputSnippet(variable));
            testConsole.Input.Push($"{expected}");

            //Act
            interpreter.Execute();

            //Assert
            parser.Variables[variable.Name].Value.Should().Be(expected);
        }
コード例 #2
0
ファイル: TestVariable.cs プロジェクト: jonathanMelly/cosmos
        private void TestValidAllocationWithValue(string variableExpression, CosmosTypedValue expectedValue,
                                                  string variablePrefix = "")
        {
            //Arrange
            var variableName   = "#maVariable";
            var expectedResult = variableName.AsCosmosVariable(expectedValue);

            BuildSnippetInterpreter(BuildAllocationSnippet(variableName, variableExpression));

            //Act
            interpreter.Execute().Should().BeTrue();

            //Assert
            parser.Variables.Should().HaveCount(1).And.ContainKey(expectedResult.Name).WhichValue.Should()
            .BeEquivalentTo(expectedResult);
        }
コード例 #3
0
 public static CosmosNumber AsCosmosNumber(this int subject, bool leading0 = false)
 {
     return(CosmosTypedValue.Number(subject, leading0));
 }
コード例 #4
0
 public static CosmosNumber AsCosmosNumber(this decimal subject)
 {
     return(CosmosTypedValue.Number(subject));
 }
コード例 #5
0
 public static CosmosBoolean AsCosmosBoolean(this bool subject)
 {
     return(CosmosTypedValue.Boolean(subject));
 }
コード例 #6
0
 public CosmosVariable(string name, CosmosTypedValue value)
 {
     this.Name  = name;
     this.Value = value;
 }
コード例 #7
0
 public CosmosVariable UpdatedTo(CosmosTypedValue newValue)
 {
     return(new CosmosVariable(Name, newValue));
 }
コード例 #8
0
 public static CosmosString AsCosmosString(this string subject)
 {
     return(CosmosTypedValue.String(subject));
 }
コード例 #9
0
 public static CosmosVariable AsCosmosVariable(this string subject, CosmosTypedValue value = null)
 {
     return(new CosmosVariable(subject, value));
 }