public void Get()
        {
            var manager = new ComicStripManager(new UnitOfWork("development"));

            manager.DeleteAll();
            var publisherManager = new PublisherManager(new UnitOfWork("development"));

            publisherManager.DeleteAll();
            publisherManager.Add(new Publisher("test-publisher"));

            var AuthorManager = new AuthorManager(new UnitOfWork("development"));

            AuthorManager.DeleteAll();

            AuthorManager.Add(new Author("test-author", "test-author"));

            manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0]));
            var comic = manager.GetAll();

            var bundleManager = new ComicstripBundleManager(new UnitOfWork("development"));

            bundleManager.DeleteAll();
            bundleManager.Add(new ComicstripBundle("test-bundle", comic, publisherManager.GetAll()[0]));
            var bundles = bundleManager.GetAll();
            var bundle  = bundleManager.Get(bundles[0].ID);

            Assert.AreEqual(bundles.Count, 1);
            Assert.AreEqual(bundle.Titel, "test-bundle");
            Assert.AreEqual(bundle.Comicstrips.Count, 1);

            manager.DeleteAll();
            AuthorManager.DeleteAll();
            bundleManager.DeleteAll();
        }
        public void Update()
        {
            var manager = new AuthorManager(new UnitOfWork("development"));

            manager.DeleteAll();
            manager.Add(new BusinessLayer.Models.Author("test-first", "test-Last"));
            var authors = manager.GetAll();

            Assert.AreEqual(authors.Count, 1);
            var author = manager.Get(authors[0].ID);

            Assert.AreEqual(author.Firstname, "test-first");
            Assert.AreEqual(author.Surname, "test-Last");
            author.SetSurname("test-Sur");
            author.SetFirstName("test-First");
            manager.Update(author);

            authors = manager.GetAll();

            Assert.AreEqual(authors.Count, 1);
            author = manager.Get(authors[0].ID);
            Assert.AreEqual(author.Firstname, "test-First");
            Assert.AreEqual(author.Surname, "test-Sur");

            manager.DeleteAll();
        }
Ejemplo n.º 3
0
        public void DeleteByID()
        {
            var manager = new ComicStripManager(new UnitOfWork("development"));

            manager.DeleteAll();
            var publisherManager = new PublisherManager(new UnitOfWork("development"));

            publisherManager.DeleteAll();
            publisherManager.Add(new Publisher("test-publisher"));

            var AuthorManager = new AuthorManager(new UnitOfWork("development"));

            AuthorManager.DeleteAll();
            AuthorManager.Add(new Author("test-author", "test-author"));

            manager.Add(new BusinessLayer.Models.ComicStrip("test-strip", new ComicstripSerie("testSerie"), 5, AuthorManager.GetAll(), publisherManager.GetAll()[0]));
            var comic = manager.GetAll();

            Assert.AreEqual(comic.Count, 1);
            var comc = manager.Get(comic[0].ID);

            Assert.AreEqual(comc.Titel, "test-strip");
            Assert.AreEqual(comc.Number, 5);
            manager.Delete(comc.ID);
            comic = manager.GetAll();
            Assert.AreEqual(comic.Count, 0);

            publisherManager.DeleteAll();
            AuthorManager.DeleteAll();
            manager.DeleteAll();
        }
        public void AddAuthor()
        {
            var manager = new AuthorManager(new UnitOfWork("development"));

            manager.DeleteAll();
            manager.Add(new BusinessLayer.Models.Author("test-first", "test-Last"));
            var authors = manager.GetAll();

            Assert.AreEqual(authors.Count, 1);
            Assert.AreEqual(authors[0].Firstname, "test-first");
            Assert.AreEqual(authors[0].Surname, "test-Last");
            manager.DeleteAll();
        }