public void AddSymbols() { SymbolTable table = new SymbolTable(); Assert.IsNotNull(table.AddSymbol("Com.Autodesk.Designscript.ProtoGeometry.Point")); Assert.IsNotNull(table.AddSymbol("Autodesk.Designscript.ProtoGeometry.Point")); Assert.IsNotNull(table.AddSymbol("Designscript.ProtoGeometry.Point")); Assert.IsNotNull(table.AddSymbol("ProtoGeometry.Point")); Assert.IsNotNull(table.AddSymbol("Designscript.Point")); Assert.IsNotNull(table.AddSymbol("Com.Autodesk.Designscript.ProtoGeometry.Vector")); Assert.AreEqual(6, table.GetSymbolCount()); }
public void GetSymbolMultipleInput() { SymbolTable table = new SymbolTable(); table.AddSymbol("Autodesk.ProtoGeometry.Point"); table.AddSymbol("Autodesk.Designscript.Point"); table.AddSymbol("Com.Autodesk.Point"); Assert.AreEqual(3, table.GetSymbolCount()); Assert.AreEqual("Com.Autodesk.Point", table.GetFullyQualifiedName("Com.Point")); Assert.AreEqual("Autodesk.ProtoGeometry.Point", table.GetFullyQualifiedName("ProtoGeometry.Point")); Assert.AreEqual("Autodesk.Designscript.Point", table.GetFullyQualifiedName("Designscript.Point")); Assert.Throws<System.Collections.Generic.KeyNotFoundException>(()=>table.GetFullyQualifiedName("Point")); Assert.Throws<System.Collections.Generic.KeyNotFoundException>(() => table.GetFullyQualifiedName("Autodesk.Point")); }
public void TryGetSymbol() { SymbolTable table = new SymbolTable(); table.AddSymbol("Autodesk.ProtoGeometry.Point"); table.AddSymbol("Autodesk.Designscript.Point"); table.AddSymbol("Com.Autodesk.Point"); Assert.AreEqual(3, table.GetSymbolCount()); Symbol symbol = null; Assert.IsTrue(table.TryGetUniqueSymbol("Com.Point", out symbol)); Assert.IsNotNull(symbol); Assert.AreEqual("Com.Autodesk.Point", symbol.FullName); symbol.Id = 123; Assert.IsTrue(table.TryGetUniqueSymbol("ProtoGeometry.Point", out symbol)); Assert.IsNotNull(symbol); Assert.AreEqual("Autodesk.ProtoGeometry.Point", symbol.FullName); Assert.IsTrue(table.TryGetUniqueSymbol("Designscript.Point", out symbol)); Assert.IsNotNull(symbol); Assert.AreEqual("Autodesk.Designscript.Point", symbol.FullName); Assert.IsFalse(table.TryGetUniqueSymbol("Point", out symbol)); Assert.IsNull(symbol); Assert.IsFalse(table.TryGetUniqueSymbol("Autodesk.Point", out symbol)); Assert.IsNull(symbol); Assert.IsFalse(table.TryGetUniqueSymbol("Autodesk.Designscript", out symbol)); Assert.IsNull(symbol); Assert.IsTrue(table.TryGetExactSymbol("Com.Autodesk.Point", out symbol)); Assert.IsNotNull(symbol); Assert.AreEqual("Com.Autodesk.Point", symbol.FullName); Assert.AreEqual(123, symbol.Id); }