/// <summary> /// Initializes a new instance of the <see cref="MongoFlagDefinition"/> /// class. /// </summary> /// <param name="definition">The definition to get data from.</param> /// <exception cref="ArgumentNullException">null definition</exception> public MongoFlagDefinition(FlagDefinition definition) { if (definition == null) { throw new ArgumentNullException(nameof(definition)); } Id = definition.Id; Label = definition.Label; Description = definition.Description; ColorKey = definition.ColorKey; }
public void Read_Profile_Ok() { string json = LoadProfile("SampleProfile.json"); IDataProfileSerializer serializer = new JsonDataProfileSerializer(); DataProfile profile = serializer.Read(json); // facets Assert.Single(profile.Facets); FacetDefinition facetDef = profile.Facets[0]; Assert.Equal("facet-default", facetDef.Id); Assert.Equal("default", facetDef.Label); Assert.Equal("The default facet", facetDef.Description); Assert.Equal("FF0000", facetDef.ColorKey); Assert.Equal(7, facetDef.PartDefinitions.Count); // TODO: check each facet definition // flags Assert.Single(profile.Flags); FlagDefinition flagDef = profile.Flags[0]; Assert.Equal(1, flagDef.Id); Assert.Equal("to revise", flagDef.Label); Assert.Equal("The item must be revised.", flagDef.Description); Assert.Equal("F08080", flagDef.ColorKey); // thesauri Assert.Equal(2, profile.Thesauri.Length); Thesaurus thesaurus = Array.Find(profile.Thesauri, t => t.Id == "categories@en"); Assert.NotNull(thesaurus); Assert.Equal(16, thesaurus.GetEntries().Count); // TODO: check each entry thesaurus = Array.Find(profile.Thesauri, t => t.Id == "languages@en"); Assert.NotNull(thesaurus); Assert.Equal(8, thesaurus.GetEntries().Count); // TODO: check each entry }
public bool HasMode(FlagDefinition mode) { return HasMode(mode.Char); }