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(); }
public ViewHome() { InitializeComponent(); ComicStripManager sm = new ComicStripManager(new UnitOfWork()); Comicstrips = new StripGrid(StripsGrid, sm.GetAll()); Comicstrips.SetDeleteButton(Button_DeleteStrips); Comicstrips.SetEditButton(Button_EditStrip); AuthorManager am = new AuthorManager(new UnitOfWork()); Authors = new AuthorGrid(AuthorsGrid, am.GetAll()); Authors.SetDeleteButton(Button_DeleteAuthors); Authors.SetEditButton(Button_EditAuthor); PublisherManager pm = new PublisherManager(new UnitOfWork()); Publishers = new PublisherGrid(PublishersGrid, pm.GetAll()); Publishers.SetDeleteButton(Button_DeletePublishers); Publishers.SetEditButton(Button_EditPublisher); ComicstripBundleManager bm = new ComicstripBundleManager(new UnitOfWork()); Bundles = new BundleGrid(BundlesGrid, bm.GetAll()); Bundles.SetDeleteButton(Button_DeleteBundles); Bundles.SetEditButton(Button_EditBundles); }
public IEnumerable <AuthorModel> Get() { var authors = authormanager.GetAll(); var results = authors.Select(author => modelfactory.Create(author)); return(results); }
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(); }
public ComicstripAddForm(TextBox title, CheckBox serieSwitcher, ComboBox serieSelect, TextBox serieNew, TextBox number, ComboBox publisher, DataGrid authors, Button submit) { this.TitleInput = title; this.TitleInput.TextChanged += InputChanged; this.SerieInputSelect = serieSelect; this.SerieInputSelect.SelectionChanged += InputChanged; this.SerieInputNew = serieNew; this.SerieInputNew.TextChanged += InputChanged; this.SerieSwitcher = serieSwitcher; this.SerieSwitcher.Click += InputChanged; this.NumberInput = number; this.NumberInput.TextChanged += InputChanged; this.PublisherInput = publisher; this.PublisherInput.SelectionChanged += InputChanged; AuthorManager am = new AuthorManager(new UnitOfWork()); this.AuthorsInput = new AuthorGrid(authors, am.GetAll()); this.AuthorsInput.Grid.SelectionChanged += InputChanged; this.SubmitButton = submit; this.SubmitButton.Click += Submit; ComicStripManager cm = new ComicStripManager(new UnitOfWork()); this.series = cm.GetAllSeries(); foreach (ComicstripSerie serie in this.series) { this.SerieInputSelect.Items.Add(serie.Name); } PublisherManager pm = new PublisherManager(new UnitOfWork()); this.publishers = pm.GetAll(); foreach (Publisher p in this.publishers) { this.PublisherInput.Items.Add(p.Name); } }
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 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(); }