public void TestCreateVideo() { TranslationRepository repo = new TranslationRepository(); VideoRepository videoRepo = new VideoRepository(); Category cat = new Category() { Title = "Spenna" }; videoRepo.addCategory(cat); Video testvideo = new Video(); testvideo.Name = "The Batman"; testvideo.Category = cat; int returnId = repo.AddVideo(testvideo); Assert.IsTrue(returnId > 0); Assert.AreEqual("Spenna", testvideo.Category.Title); Assert.AreEqual(cat.ID, testvideo.CategoryID); }
public int addCategory(Category cat) { this.m_db.Categories.Add(cat); this.m_db.SaveChanges(); return cat.ID; }