Пример #1
0
        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);
        }
Пример #2
0
 public int addCategory(Category cat)
 {
     this.m_db.Categories.Add(cat);
     this.m_db.SaveChanges();
     return cat.ID;
 }