public void DictionaryRoundTripTest2() { // dictionary with sub-dictionary wit DICTIONARYVAR value var dict1 = new DxfDictionary(); var dict2 = new DxfDictionary(); dict1["key-1"] = dict2; dict2["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict1); var text = ToString(file); var parsedFile = Parse(text); var roundTrippedDict1 = parsedFile.Objects.OfType <DxfDictionary>().First(d => d.ContainsKey("key-1")); var roundTrippedDict2 = (DxfDictionary)roundTrippedDict1["key-1"]; Assert.Equal("value-2", ((DxfDictionaryVariable)roundTrippedDict2["key-2"]).Value); }
public void DictionaryRoundTripTest3() { // dictionary with default with DICTIONARYVAR values var dict = new DxfDictionaryWithDefault(); dict.DefaultObject = new DxfDictionaryVariable() { Value = "default-value" }; dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict); var text = ToString(file); var parsedFile = Parse(text); var roundTrippedDict = parsedFile.Objects.OfType <DxfDictionaryWithDefault>().Single(); Assert.Equal("value-1", ((DxfDictionaryVariable)roundTrippedDict["key-1"]).Value); Assert.Equal("default-value", ((DxfDictionaryVariable)roundTrippedDict.DefaultObject).Value); }
public void DictionaryRoundTripTest1() { // dictionary with DICTIONARYVAR values var dict = new DxfDictionary(); dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; dict["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; var file = new DxfFile(); file.Clear(); file.Header.Version = DxfAcadVersion.R2000; file.Objects.Add(dict); var text = ToString(file); var parsedFile = Parse(text); var roundTrippedDict = parsedFile.Objects.OfType <DxfDictionary>().Single(d => d.Keys.Count == 2); Assert.Equal("value-1", ((DxfDictionaryVariable)roundTrippedDict["key-1"]).Value); Assert.Equal("value-2", ((DxfDictionaryVariable)roundTrippedDict["key-2"]).Value); }
public void WriteDictionaryTest1() { // dictionary with simple DICTIONARYVAR values var dict = new DxfDictionary(); dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; dict["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; EnsureFileContainsObject(dict, @" 0 DICTIONARY 5 # 100 AcDbDictionary 281 0 3 key-1 350 # 3 key-2 350 # 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-1 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-2 ", DxfAcadVersion.R2000); }
public void WriteDictionaryTest3() { // dictionary with default with DICTIONARYVAR value var dict = new DxfDictionaryWithDefault(); dict.DefaultObject = new DxfDictionaryVariable() { Value = "default-value" }; dict["key-1"] = new DxfDictionaryVariable() { Value = "value-1" }; EnsureFileContainsObject(dict, @" 0 ACDBDICTIONARYWDFLT 5 # 100 AcDbDictionary 281 0 3 key-1 350 # 100 AcDbDictionaryWithDefault 340 # 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 default-value 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-1 ", DxfAcadVersion.R2000); }
public void WriteDictionaryTest2() { // dictionary with sub-dictionary with DICTIONARYVAR value var dict1 = new DxfDictionary(); var dict2 = new DxfDictionary(); dict1["key-1"] = dict2; dict2["key-2"] = new DxfDictionaryVariable() { Value = "value-2" }; EnsureFileContainsObject(dict1, @" 0 DICTIONARY 5 # 100 AcDbDictionary 281 0 3 key-1 350 # 0 DICTIONARY 5 # 330 # 100 AcDbDictionary 281 0 3 key-2 350 # 0 DICTIONARYVAR 5 # 330 # 100 DictionaryVariables 280 0 1 value-2 ", DxfAcadVersion.R2000); }
public void Visit(DxfDictionaryVariable dictionaryVariable) { }
public void Visit(DxfDictionaryVariable dictionaryVariable) { this.bool_0 = true; }