예제 #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 CanCreateDefaultModel()
        {
            var model = new Model("TestModel");

            // Check if values are initialized
            Assert.IsNotNull(model);
            Assert.IsNotNull(model.MetaItems);
            Assert.IsNotNull(model.Items);
            Assert.IsNotNull(model.Words);

            Assert.AreEqual(0, model.MetaItems.Count());
            Assert.AreEqual(0, model.Items.Count());
            Assert.AreEqual(0, model.Words.Count());

            // Check if the value of the word actually is as expected.
            Assert.AreEqual("TestModel", model.Name);
        }
예제 #3
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));
        }
예제 #4
0
 public Association(Model model, string id)
 {
     _model = model;
     _edge = (model as IModelGraphAdapter).GetEdge(new EdgeId(id));
 }
예제 #5
0
 public void Setup()
 {
     _model = new Model("abc");
 }
예제 #6
0
 public Word(Model model, string id)
 {
     _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id));
 }
예제 #7
0
 public Item(Model model, string id)
 {
     _model = model;
     _vertex = (model as IModelGraphAdapter).GetVertex(new VertexId(id));
 }