示例#1
0
        public void AddRemoveLocalizedStringTest()
        {
            IModel m = GetModel();

            m.Clear();

            Uri t1Uri           = new Uri("semio:test:testInstance1");
            MappingTestClass t1 = m.CreateResource <MappingTestClass>(t1Uri);

            t1.AddProperty(TestOntology.uniqueStringTest, "Hallo Welt", "de");
            t1.Commit();

            var t1ref  = m.GetResource <MappingTestClass>(t1Uri);
            var values = t1ref.ListValues(TestOntology.uniqueStringTest);

            Assert.IsTrue(values.OfType <Tuple <string, string> >().Any(t => t.Item1 == "Hallo Welt" && t.Item2 == "de"));

            t1.RemoveProperty(TestOntology.uniqueStringTest, "Hallo Welt", "de");
            t1.Commit();

            t1ref  = m.GetResource <MappingTestClass>(t1Uri);
            values = t1ref.ListValues(TestOntology.uniqueStringTest);

            Assert.AreEqual(0, values.Count());
        }
        //[Test]
        // This test does not run, but it needs to.
        public void AddUnmappedType()
        {
            IModel m = GetModel();

            m.Clear();

            Uri t1Uri           = new Uri("semio:test:testInstance1");
            Uri t2Uri           = new Uri("semio:test:testInstance2");
            MappingTestClass t1 = m.CreateResource <MappingTestClass>(t1Uri);

            IResource r = m.CreateResource(t2Uri);

            r.AddProperty(rdf.type, TestOntology.TestClass2);

            t1.AddProperty(TestOntology.uniqueResourceTest, r);
            t1.AddProperty(TestOntology.resourceTest, r);

            Assert.IsNull(t1.uniqueResourceTest);
            Assert.AreEqual(0, t1.resourceTest.Count);

            m.Clear();
        }
        public void AddRemoveLocalizedStringTest()
        {
            IModel m = GetModel();

            m.Clear();
            Uri t1Uri           = new Uri("semio:test:testInstance1");
            MappingTestClass t1 = m.CreateResource <MappingTestClass>(t1Uri);

            t1.AddProperty(TestOntology.uniqueStringTest, "Hallo Welt", "de");
            t1.Commit();

            var tt = m.GetResource <MappingTestClass>(t1Uri);
        }