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); }
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); }
public static CosmosNumber AsCosmosNumber(this int subject, bool leading0 = false) { return(CosmosTypedValue.Number(subject, leading0)); }
public static CosmosNumber AsCosmosNumber(this decimal subject) { return(CosmosTypedValue.Number(subject)); }
public static CosmosBoolean AsCosmosBoolean(this bool subject) { return(CosmosTypedValue.Boolean(subject)); }
public CosmosVariable(string name, CosmosTypedValue value) { this.Name = name; this.Value = value; }
public CosmosVariable UpdatedTo(CosmosTypedValue newValue) { return(new CosmosVariable(Name, newValue)); }
public static CosmosString AsCosmosString(this string subject) { return(CosmosTypedValue.String(subject)); }
public static CosmosVariable AsCosmosVariable(this string subject, CosmosTypedValue value = null) { return(new CosmosVariable(subject, value)); }