コード例 #1
0
        public void Given_MetaDataIsPresent_When_ModelIsCleared_Then_OnlyDefaultGroupAndItemsArePresent()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            string groupName = "ImportedGroupName";
            string name1     = "SomeItemName1";
            string value1    = "SomeItemValue2";

            model.AddMetaDataItem(groupName, name1, value1);
            string name2  = "SomeItemName";
            string value2 = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name2, value2);

            List <string> groupsBefore = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(2, groupsBefore.Count);

            model.Clear();

            List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groupsAfter.Count);

            List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(1, items.Count);
            Assert.IsTrue(items[0].Name == "Executable");
            Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test"));
        }
コード例 #2
0
        public void WhenAddMetaDataItemIsCalledThenGroupIsAdded()
        {
            string        defaultGroupName = "DefaultGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());
            List <string> groupsBefore     = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groupsBefore.Count);

            string groupName = "ImportedGroupName";
            string name      = "SomeItemName";
            string value     = "SomeItemValue1";

            model.AddMetaDataItem(groupName, name, value);

            List <string> groupsAfter = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(2, groupsAfter.Count);
            Assert.AreEqual(groupsBefore[0], groupsAfter[0]);
            Assert.AreEqual(groupName, groupsAfter[1]);
        }
コード例 #3
0
        public void When_ModelIsConstructed_Then_OnlyDefaultGroupAndItemsArePresen()
        {
            string        defaultGroupName = "SomeGroupName";
            MetaDataModel model            = new MetaDataModel(defaultGroupName, Assembly.GetExecutingAssembly());

            List <string> groups = model.GetExportedMetaDataGroups().ToList();

            Assert.AreEqual(1, groups.Count);
            Assert.AreEqual(defaultGroupName, groups[0]);

            List <IMetaDataItem> items = model.GetExportedMetaDataGroupItems(defaultGroupName).ToList();

            Assert.AreEqual(1, items.Count);
            Assert.IsTrue(items[0].Name == "Executable");
            Assert.IsTrue(items[0].Value.Contains("DsmSuite.Common.Model.Test"));
        }
コード例 #4
0
 public IEnumerable <string> GetMetaDataGroups()
 {
     return(_metaDataModel.GetExportedMetaDataGroups());
 }