Esempio n. 1
0
        public void AllItemsTest()
        {
            var repo = new AudiencesRepository(_context);

            Assert.AreEqual(_context.Audiences.Count(), repo.AllItems.Count());
            var item1 = new Audience {
                Name = "Test802"
            };
            var item2 = new Audience {
                Name = "Test802"
            };

            repo.AddItem(item1);
            repo.AddItem(item2);
            Assert.AreEqual(_context.Audiences.Count(), repo.AllItems.Count());
            _context.Audiences.Remove(item1);
            _context.Audiences.Remove(item2);
        }
Esempio n. 2
0
        public void GetItemTest()
        {
            var repo = new AudiencesRepository(_context);
            var item = new Audience {
                Name = "Test804"
            };

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

            Assert.AreEqual(item.Name, repo.GetItem(Id).Name);
            _context.Audiences.Remove(item);
        }
Esempio n. 3
0
        public void AddItemTest()
        {
            var repo = new AudiencesRepository(_context);
            var item = new Audience {
                Name = "Test888"
            };

            repo.AddItem(item);
            string name = _context.Audiences.FirstOrDefault(x => x.Name == item.Name).Name;

            Assert.AreEqual(item.Name, name);
            _context.Audiences.Remove(item);
        }
Esempio n. 4
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);
        }