public PunishedUser(PunishedUserEntity entity, AutoPunishment autoPunishment) { Id = entity.Id; Nick = entity.Nick; Count = entity.Count; AutoPunishment = autoPunishment; }
public PunishedUser(PunishedUserEntity entity) { Id = entity.Id; Nick = entity.Nick; Count = entity.Count; AutoPunishment = new AutoPunishment(entity.AutoPunishmentEntity); }
public void QueryCommandServiceAddingIncompleteEntity_Always_ThrowsForeignKeyException() { var contextService = TestContainerManager.GetContainerWithRecreatedAndIsolatedDatabase().GetInstance <IQueryCommandService <IBotDbContext> >(); var punishedUser = new PunishedUserEntity { Count = 1, AutoPunishmentId = 1, Nick = "", }; var exception = TestHelper.AssertCatch <DbUpdateException>(() => contextService.Command(db => db.PunishedUsers.Add(punishedUser))); Assert.AreEqual("SQLite Error 19: 'FOREIGN KEY constraint failed'.", exception.InnerException.Message); }