Ejemplo n.º 1
0
        public void CharacterCrud_Update()
        {
            _ctx.Characters.Add(_character);
            _ctx.SaveChanges();

            _ctx = new SordidDbContext();
            _character = _ctx.Characters.Where(c => c.Id == _character.Id).First();
            _character.Name = "Updated!";
            _ctx.SaveChanges();

            _ctx = new SordidDbContext();
            _character = _ctx.Characters.Where(c => c.Id == _character.Id).First();
            Assert.AreEqual("Updated!", _character.Name);
        }
Ejemplo n.º 2
0
        public void CharacterCrud_Delete()
        {
            _ctx.Characters.Add(_character);
            _ctx.SaveChanges();

            _ctx = new SordidDbContext();
            _character = _ctx.Characters.Where(c => c.Id == _character.Id).First();
            _ctx.Characters.Remove(_character);
            _ctx.SaveChanges();

            _ctx = new SordidDbContext();
            _character = _ctx.Characters.Where(c => c.Id == _character.Id).FirstOrDefault();
            Assert.IsNull(_character);
        }