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); }
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); }
public void SetUp() { _ctx = new SordidDbContext(); var randomGoodUserId = _ctx.Users.First().Id; _character = new Character { Name = "Test Character", ApplicationUserId = randomGoodUserId }; }
public UnitOfWork(SordidDbContext context) { Context = context; Identity = Guid.NewGuid(); }