public void AddSymbol_ShouldAddSymbolIfCorrectDataIsGiven() { var typeEnv = new TypeEnvironment(); var symbolToAdd = (Name : "HelloWorld", Type : new BooleanValueType()); typeEnv.AddSymbol(symbolToAdd.Name, symbolToAdd.Type); Assert.Equal(symbolToAdd.Type, typeEnv.GetTypeOf(symbolToAdd.Name)); }
public void AddSymbol_ShouldThrowExceptionIfNullSymbolTypeIsGiven() { var typeEnv = new TypeEnvironment(); Assert.Throws <ArgumentNullException>(() => typeEnv.AddSymbol("HelloWorld", null)); }
public void AddSymbol_ShouldThrowExceptionIfInvalidNameIsGiven(string symbolName) { var typeEnv = new TypeEnvironment(); Assert.Throws <ArgumentNullException>(() => typeEnv.AddSymbol(symbolName, new BooleanValueType())); }