public void Test_Standart() { Assembly assembly = typeof(CoreTests).Assembly; using (Stream inStream = assembly.GetManifestResourceStream("GKTests.Resources.TGC55CLF.GED")) { using (GDMTree tree = new GDMTree()) { var gedcomProvider = new GEDCOMProvider(tree); gedcomProvider.LoadFromStreamExt(inStream, inStream); Assert.AreEqual(GEDCOMFormat.gf_Unknown, tree.Format); GDMMultimediaRecord mmRec1 = tree.XRefIndex_Find("M1") as GDMMultimediaRecord; Assert.IsNotNull(mmRec1); GDMTag blobTag = mmRec1.FindTag("BLOB", 0); Assert.IsNotNull(blobTag); var strBlob = GEDCOMUtils.GetTagStrings(blobTag).Text; Assert.IsNotNull(strBlob); MemoryStream blobStream = GEDCOMUtils.DecodeBlob(strBlob.Replace("\r\n", "")); Assert.IsNotNull(blobStream); // unsupported apple's `pict` format /*using (FileStream file = new FileStream("d:\\image.pict", FileMode.Create, FileAccess.Write)) { * blobStream.WriteTo(file); * blobStream.Close(); * }*/ using (MemoryStream outStream = new MemoryStream()) { gedcomProvider = new GEDCOMProvider(tree); gedcomProvider.SaveToStreamExt(outStream, GEDCOMCharacterSet.csASCII); } } } }
public void Test_SetTagStringsL() { var tag = GDMTag.Create(null, GEDCOMTagsTable.Lookup("TEST"), ""); Assert.IsNotNull(tag); // very long string, 248"A" and " BBB BBBB" var strings = new GDMLines("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA BBB BBBB"); GEDCOMUtils.SetTagStrings(null, strings); GEDCOMUtils.SetTagStrings(tag, strings); Assert.AreEqual(248, tag.StringValue.Length); var strList = GEDCOMUtils.GetTagStrings(tag); Assert.IsNotNull(strList); Assert.AreEqual(1, strList.Count); Assert.AreEqual(strings.Text, strList.Text); }