コード例 #1
0
        public void AddCatalogTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog catalog = new Catalog("Andrzej", "Sapkowski", 2000, "The Witcher", 8);

            test.AddCatalog(catalog);

            Assert.AreEqual(test.ReadCatalog(8), catalog);
        }
コード例 #2
0
        public void UpdateCatalogTest()
        {
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DataChamber           data   = new DataChamber();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog newCatalog           = new Catalog("Lokok", "Test", 1908, "Testowy", 9);

            test.UpdateCatalog(3, newCatalog);

            Assert.AreEqual(newCatalog, test.ReadCatalog(3));
        }
コード例 #3
0
        public void DeleteCatalogTest()
        {
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DataChamber           data   = new DataChamber();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog newCatalog           = new Catalog("Lokok", "Test", 1908, "Testowy", 5);

            test.AddCatalog(newCatalog);
            Assert.AreEqual(test.ReadCatalog(5), newCatalog);

            test.DeleteCatalog(5);
            Assert.IsFalse(test.ReadAllCatalogs().ContainsValue(newCatalog));
        }
コード例 #4
0
        public void ReadCatalogTest()
        {
            DataChamber           data   = new DataChamber();
            DefaultDataGeneration filler = new DefaultDataGeneration();
            DatabaseActions       test   = new DatabaseActions(data, filler);
            Catalog readCatalog          = test.ReadCatalog(3);

            Assert.AreEqual(readCatalog.getAuthorsName(), "Scott");
            Assert.AreEqual(readCatalog.getAuthorsSurname(), "Fitzgerald");
            Assert.AreEqual(readCatalog.getTitle(), "The Great Gatsby");
            Assert.AreEqual(readCatalog.getKey(), 3);
            Assert.AreEqual(readCatalog.getPublicationDate(), 1925);
        }