public void AddFunction_AlreadyDefinedSymbol_ThrowsException() { Environment environment = new Environment(); DefinedSymbolException exception = Assert.Throws <DefinedSymbolException>(() => { environment.AddFunction("sin", null); }); Assert.AreEqual("Symbol sin has already been defined", exception.Message); }
public void AddValue_AlreadyDefinedSymbol_ThrowsException() { Environment environment = new Environment(); environment.AddValue("x", 2); DefinedSymbolException exception = Assert.Throws <DefinedSymbolException>(() => { environment.AddSymbol("x"); }); Assert.AreEqual("Symbol x has already been defined", exception.Message); }