Exemplo n.º 1
0
        public void DataBoxAddItemWithLink()
        {
            //Arrange
            var data = new DataBox("test.xml");

            //Act
            LinkEntry entry = data.NewLinkEntry("name", "description");
            LinkItem  link  = entry.AddLink("link", "http://testlink.ca");

            //Assert
            Assert.AreEqual(1, data.Entries.Count);
            Assert.AreEqual("link", ((LinkEntry)data.Entries[0]).Links[0].Name);
            Assert.AreEqual("http://testlink.ca", ((LinkEntry)data.Entries[0]).Links[0].Link);
            Assert.AreEqual(link, ((LinkEntry)data.Entries[0]).Links[0]);
        }
Exemplo n.º 2
0
        public void DataBoxAddItemWithLinkWithTag()
        {
            //Arrange
            var data = new DataBox("test.xml");
            var tag  = data.NewTag("test", "link");

            //Act
            LinkEntry entry = data.NewLinkEntry("name", "description");
            LinkItem  link  = entry.AddLink("link", "http://testlink.ca");

            link.AddTag(tag);

            //Assert
            Assert.AreEqual(1, data.Entries.Count);
            Assert.AreEqual("link", ((LinkEntry)data.Entries[0]).Links[0].Name);
            Assert.AreEqual("http://testlink.ca", ((LinkEntry)data.Entries[0]).Links[0].Link);
            Assert.IsTrue(((LinkEntry)data.Entries[0]).Links[0].Tags.Any(x => x.Name == "test"));
            Assert.AreEqual(link, ((LinkEntry)data.Entries[0]).Links[0]);
            Assert.IsTrue(((LinkEntry)data.Entries[0]).Links[0].Tags.Contains(tag));
        }