private void DbCompiledModel_GetConstructorDelegate_can_be_accessed_from_multiple_threads_concurrently_implementation <TContext>() where TContext : ObjectContext { ExecuteInParallel( () => { var constructor = DbCompiledModel.GetConstructorDelegate <TContext>(); try { // We can't make an ObjectContext inexpensively so we don't want to make a real one // in a unit test, therefore we just pass null and check for the exception. constructor(null); Assert.True(false); } catch (ArgumentNullException ex) { Assert.Equal("connection", ex.ParamName); } }); }