Exemple #1
0
        public void Item_SetTag_May_Dont_Override_Value()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("value1"));
            Assert.AreEqual("value1", item.GetTag("mytag").ToString());

            item.SetTag("mytag", Value.Get("value2"), false);
            Assert.AreEqual("value1", item.GetTag("mytag").ToString());
        }
Exemple #2
0
        public void Item_GetTag_Returns_Value_By_Tag()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("myvalue"));
            item.SetTag("histag", Value.Get("hisvalue"));
            item.SetTag("hertag", Value.Get("hervalue"));
            item.SetTag("dummy", Value.Get("none"));

            Assert.IsTrue(Value.IsNullOrEmpty(item.GetTag("unknowntag")));
            Assert.AreEqual("myvalue", item.GetTag("mytag").ToString());
        }
Exemple #3
0
        public void Item_GetTag_Returns_Value_By_TagAndValueTemplate()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("myvalue"));
            item.SetTag("histag", Value.Get("hisvalue"));
            item.SetTag("hertag", Value.Get("hervalue"));
            item.SetTag("dummy", Value.Get("none"));

            Assert.True(Value.IsNullOrEmpty(item.GetTag(new Mask("unknowntag"))));
            Assert.Equal("hisvalue", item.GetTag(new Mask("tag"), new Mask("his")).ToString());
        }
Exemple #4
0
        public void Item_GetTag_Returns_Value_By_TagTemplate_InAlphabeticalOrder()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("myvalue"));
            item.SetTag("histag", Value.Get("hisvalue"));
            item.SetTag("hertag", Value.Get("hervalue"));
            item.SetTag("dummy", Value.Get("none"));

            Assert.IsTrue(Value.IsNullOrEmpty(item.GetTag(new Mask("unknowntag"))));
            Assert.AreEqual("hervalue", item.GetTag(new Mask("tag")).ToString()); // the order is - dummy, hertag, histag, mytag
            Assert.AreEqual("hisvalue", item.GetTag(new Mask("histag")).ToString());
        }
Exemple #5
0
        public void Item_SetTag_Can_Override_Value()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("value1"));
            Assert.Equal("value1", item.GetTag("mytag").ToString());

            item.SetTag("mytag", Value.Get("value2"));
            Assert.Equal("value2", item.GetTag("mytag").ToString());

            item.SetTag("mytag", Value.Get("value3"), true);
            Assert.Equal("value3", item.GetTag("mytag").ToString());
        }
Exemple #6
0
        public void Item_ParseTags_Populates_TagsWithValues()
        {
            TestItem item = new TestItem();

            item.ParseTags(" MyTag: 2012/02/02", null);
            Assert.AreEqual("2012/02/02", item.GetTag("MyTag").ToString());
        }
Exemple #7
0
        public void Item_ParseTags_Ignores_Empty_Note()
        {
            TestItem item = new TestItem();

            item.ParseTags(null, null);
            Assert.IsTrue(Value.IsNullOrEmpty(item.GetTag(new Mask(".*"))));
        }
Exemple #8
0
        public void Item_SetTag_Adds_The_Tag_With_Value()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag", Value.Get("value"));
            Assert.AreEqual("value", item.GetTag("mytag").ToString());
        }
Exemple #9
0
        public void Item_SetTag_Adds_The_Tag_With_Empty_Value()
        {
            TestItem item = new TestItem();

            item.SetTag("mytag");
            Assert.IsTrue(item.HasTag("mytag"));
            Assert.IsTrue(Value.IsNullOrEmpty(item.GetTag("mytag")));
        }