Ejemplo n.º 1
0
        public void AddTest_DuplivateElements()
        {
            Catalog myTestCatalog = new Catalog();
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));

            int expected = 2;
            Assert.AreEqual(expected, myTestCatalog.Count);
        }
Ejemplo n.º 2
0
        public void GetListContentTest_MoreThenReqMatchCount()
        {
            Catalog myTestCatalog = new Catalog();
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Two", "Meta", "8341120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Three", "fou", "8342120", "http://goao.gl/daIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Foo", "Bar", "8341126", "http://goao.gl/dIkth7gs" }));

            int expected = 1;
            var matched = myTestCatalog.GetListContent("One", 1);
            Assert.AreEqual(expected, matched.Count());
        }
Ejemplo n.º 3
0
        public void UpdateContentTest_DoubleSameUpdate()
        {
            Catalog myTestCatalog = new Catalog();
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Two", "Meta", "8341120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Three", "fou", "8342120", "http://goao.gl/daeIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Foo", "Bar", "8341126", "http://goao.gl/dIkth7gs" }));

            int expected = 1;
            myTestCatalog.UpdateContent("http://goo.gl/dIkth7gs", "UPDATER");
            int updated = myTestCatalog.UpdateContent("UPDATER", "MEGA_UPDATER");
            Assert.AreEqual(expected, updated);
        }
Ejemplo n.º 4
0
        public void UpdateContentTest_MultipleUpdates()
        {
            Catalog myTestCatalog = new Catalog();
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Two", "Meta", "8341120", "http://goo.gl/dIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Three", "fou", "8342120", "http://goao.gl/daIkth7gs" }));
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "Foo", "Bar", "8341126", "http://goao.gl/dIkth7gs" }));

            int expected = 4;
            int updated = myTestCatalog.UpdateContent("http://goo.gl/dIkth7gs", "UPDATER");
            Assert.AreEqual(expected, updated);
        }