コード例 #1
0
        public void AddAndRemoveEntries_Test()
        {
            fls.Login("Gold");
            Assert.IsFalse(fl.CheckIfEntryExists("The Tempest", "William Shakespeare", false));
            int temp = fl.CountAllBooks();

            fls.AddCatalogEntry("The Tempest", "William Shakespeare", false);
            Assert.IsTrue(fl.CheckIfEntryExists("The Tempest", "William Shakespeare", false));

            fls.AddBook("The Tempest", "William Shakespeare", false);
            fls.AddBook("The Tempest", "William Shakespeare", false);

            Assert.AreEqual(fl.CountAllBooks(), temp + 2);

            fls.RemoveCatalogEntry("The Tempest", "William Shakespeare", false);

            Assert.AreEqual(fl.GetEvents()[2].type, EventType.REMOVE_A_BOOK);
            Assert.AreEqual(fl.GetEvents()[2].actor.Username, "Gold");
            Assert.AreEqual(fl.GetEvents()[2].bookAffected.Title, "The Tempest");

            Assert.AreEqual(fl.GetEvents()[3].type, EventType.REMOVE_A_BOOK);
            Assert.AreEqual(fl.GetEvents()[3].actor.Username, "Gold");
            Assert.AreEqual(fl.GetEvents()[3].bookAffected.Title, "The Tempest");

            Assert.AreEqual(fl.CountAllBooks(), temp);
            Assert.IsFalse(fl.CheckIfEntryExists("The Tempest", "William Shakespeare", false));
        }