Пример #1
0
        public void CanFindRelatedMetaItemsThroughMetaAssociations()
        {
            var model = new Model("abc");
            var source = model.AddMetaItem("source");
            var target = model.AddMetaItem("target");

            model.AddMetaAssocation(source.Id, target.Id);

            Assert.AreEqual(1, source.MetaAssociations.Where(a => a.TargetMetaItem.Equals(target)).Count());
        }
Пример #2
0
        public void Can_Add_Two_Different_MetaItems_On_Model_And_Create_MetaAssociation_Between_Them()
        {
            // Arrange
            var model = new Model("TestModel");

            // Act
            var mi1 = model.AddMetaItem("MetaItem1");
            var mi2 = model.AddMetaItem("MetaItem2");

            model.AddMetaAssocation(mi1.Id, mi2.Id);

            //Assert
            Assert.AreEqual(1, model.MetaAssociations.Count());
            Assert.AreEqual(2, model.MetaItems.Count());

            Assert.IsTrue(model.MetaItems.Contains(mi1));
            Assert.IsTrue(model.MetaItems.Contains(mi2));
        }