Esempio n. 1
0
        public void DeleteItemTest()
        {
            var repo = new AudiencesRepository(_context);
            var item = new Audience {
                Name = "Test805"
            };

            repo.AddItem(item);
            int Id = _context.Audiences.FirstOrDefault(x => x.Name == item.Name).Id;

            Assert.AreEqual(item.Name, repo.GetItem(Id).Name);
            repo.DeleteItem(Id);
            Assert.AreEqual(item.Name, repo.GetItem(Id).Name);
        }
Esempio n. 2
0
        public void ChangeItemTest()
        {
            var repo = new AudiencesRepository(_context);
            var item = new Audience {
                Name = "Test806"
            };

            repo.AddItem(item);
            int Id      = _context.Audiences.FirstOrDefault(x => x.Name == item.Name).Id;
            var newitem = repo.GetItem(Id);

            newitem.Name = "Test807";
            repo.ChangeItem(newitem);
            Assert.AreEqual(newitem.Name, _context.Audiences.FirstOrDefault(x => x.Name == newitem.Name).Name);
            _context.Audiences.Remove(newitem);
        }
Esempio n. 3
0
 public void GetItemExceptionTest()
 {
     var repo  = new AudiencesRepository(_context);
     var item1 = repo.GetItem(-1).Name;
 }