public void InsertingEmptyCompetenceThrowsExceptionTest() { Competence competence = new Competence { }; context.Entry(competence).State = EntityState.Added; Assert.Throws<DbEntityValidationException>(() => context.SaveChanges()); }
public void InsertingNonUniqueCompetenceThrowsExceptionTest() { Competence competence = new Competence { DefaultName = "test_competence" }; Competence competenceShallowCopy = new Competence { DefaultName = competence.DefaultName }; context.Entry(competence).State = EntityState.Added; context.Entry(competenceShallowCopy).State = EntityState.Added; Assert.Throws<DbUpdateException>(() => context.SaveChanges()); }
public void CanInsertValidCompetenceTest() { Competence competence = new Competence { DefaultName = "test_competence" }; context.Entry(competence).State = EntityState.Added; Assert.DoesNotThrow(() => context.SaveChanges()); }