public void MetadataDefaultValue_MetaGroup() { MetaGroup group; group = new MetaGroup(); Assert.IsNull(group.AppliesTo, "AppliesTo is incorrect."); Assert.IsNull(group.Category, "Category is incorrect."); Assert.AreEqual(0, group.Containers.Count, "Containers count is incorrect."); Assert.IsNull(group.Id, "Id is incorrect."); }
/// <summary> /// Demonstrates how to store metadata in a <see cref="File"/> element. /// </summary> public static void StoreMetadata() { File file; Meta meta; MetaGroup metaGroup; file = new File("id"); file.Metadata = new MetadataContainer(); metaGroup = new MetaGroup(); metaGroup.AppliesTo = MetaGroupSubject.Source; metaGroup.Category = "document_state"; metaGroup.Id = "g1"; file.Metadata.Groups.Add(metaGroup); meta = new Meta("draft"); meta.Type = "phase"; metaGroup.Containers.Add(meta); }
public void XliffWriter_Metadata() { MetaGroup group; Unit unit; string actualValue; group = new MetaGroup(); group.AppliesTo = MetaGroupSubject.Source; group.Category = "category"; group.Containers.Add(new Meta("type", "text")); unit = new Unit("u1"); unit.Metadata = new MetadataContainer(); unit.Metadata.Groups.Add(group); this._document.Files.Add(new File("f1")); this._document.Files[0].Containers.Add(unit); actualValue = this.Serialize(); Assert.AreEqual(TestUtilities.GetFileContents(TestData.UnitWithMetadata), actualValue); }
/// <summary> /// Creates a metadata group with every element and attribute. /// </summary> /// <returns>The created metadata group.</returns> private MetaGroup CreateMetaGroup(bool nest) { MetaGroup result; result = new MetaGroup(); result.Id = "metagroup" + this.GetNextId(typeof(MetaGroup)); result.Category = "category"; result.AppliesTo = MetaGroupSubject.Ignorable; if (nest) { result.Containers.Add(this.CreateMetaGroup(false)); } result.Containers.Add(this.CreateMeta()); return result; }