public void ComposeTest() { var writer = new CgmWriter(FileFormat.Binary, ""); writer.SetDescription("Created By UnitTest"); writer.SetElementList("DRAWINGPLUS"); writer.SetFontList(new[] { "Arial", "Arial Bold" }); writer.SetCharacterSetList(new[] { new KeyValuePair <CharacterSetList.Type, string>(CharacterSetList.Type._94_CHAR_G_SET, "B"), new KeyValuePair <CharacterSetList.Type, string>(CharacterSetList.Type._96_CHAR_G_SET, "A"), new KeyValuePair <CharacterSetList.Type, string>(CharacterSetList.Type.COMPLETE_CODE, "I"), new KeyValuePair <CharacterSetList.Type, string>(CharacterSetList.Type.COMPLETE_CODE, "L") }); writer.SetVDCType(VdcType.Type.Real); writer.Finish(); var binaryFile = new BinaryCgmFile(new MemoryStream(writer.GetContent())); var actual = ConvertToClearText(binaryFile); var expected = new StringBuilder(); expected.AppendLine("BEGMF '';"); expected.AppendLine(" mfversion 1;"); expected.AppendLine(" mfdesc 'Created By UnitTest';"); expected.AppendLine(" mfelemlist 'DRAWINGPLUS';"); expected.AppendLine(" fontlist 'Arial', 'Arial Bold';"); expected.AppendLine(" charsetlist STD94 'B' STD96 'A' COMPLETECODE 'I' COMPLETECODE 'L';"); expected.AppendLine(" vdctype real;"); //expected.AppendLine(" colrprec 255;"); //expected.AppendLine(" colrindexprec 127;"); //expected.AppendLine(" colrvalueext 0 0 0, 255 255 255;"); //expected.AppendLine(" maxcolrindex 255;"); //expected.AppendLine(" integerprec - 32768, 32767 % 16 binary bits %;"); //expected.AppendLine(" realprec - 511.0000, 511.0000, 7 % 10 binary bits %;"); //expected.AppendLine(" charcoding BASIC8BIT;"); expected.AppendLine("ENDMF;"); Assert.AreEqual(expected.ToString().Replace("\r\n", "\n"), actual); }
public void Floating_String_Test(string data) { var writer = new CgmWriter(FileFormat.Binary, ""); writer.SetDescription(data); writer.Finish(); var binaryFile = new BinaryCgmFile(new MemoryStream(writer.GetContent())); var actual = ConvertToClearText(binaryFile); var expected = new StringBuilder(); expected.AppendLine("BEGMF '';"); expected.AppendLine(" mfversion 1;"); expected.AppendLine($" mfdesc '{data}';"); expected.AppendLine("ENDMF;"); Assert.AreEqual(expected.ToString().Replace("\r\n", "\n"), actual); }