コード例 #1
0
        public void AddTest_SingleElement()
        {
            Catalog myTestCatalog = new Catalog();
            myTestCatalog.Add(new Content(Contents.Book, new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" }));

            int expected = 1;
            Assert.AreEqual(expected, myTestCatalog.Count);
        }
コード例 #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());
        }
コード例 #3
0
        public static void Main()
        {
            StringBuilder output = new StringBuilder();
            Catalog catalog = new Catalog();
            ICommandExecutor commandExcutor = new CommandExecutor();

            foreach (ICommand item in Parse())
            {
                commandExcutor.ExecuteCommand(catalog, item, output);
            }

            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.Write(output);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }