public void EFContext_Can_Insert_Airport_with_wrong_Iata_throws_Exception() { Fixture fix = new Fixture(); Airport a = fix.Build <Airport>() .Without(x => x.ID) .Without(x => x.Iata) .Without(x => x.LocInt) .Create(); a.LocInt = "ABCD"; //gültig a.Iata = "sehrfalscherIATACode"; // absichtlich ungültig using (EFContext context = new EFContext()) { context.Airport.Add(a); context.Invoking(x => x.SaveChanges()).Should().Throw <DbUpdateException>(); } }