public void Query_when_null_key_in_database_should_throw() { using (var testStore = NpgsqlTestStore.CreateScratch()) { testStore.ExecuteNonQuery(@"CREATE TABLE ""ZeroKey"" (""Id"" int)"); testStore.ExecuteNonQuery(@"INSERT INTO ""ZeroKey"" VALUES (NULL)"); using (var context = new NullKeyContext(testStore.ConnectionString)) { Assert.Equal( CoreStrings.InvalidKeyValue("ZeroKey"), Assert.Throws <InvalidOperationException>(() => context.ZeroKeys.ToList()).Message); } } }
public void Query_when_null_key_in_database_should_throw() { using (var testStore = SqlServerTestStore.CreateScratch()) { testStore.ExecuteNonQuery( @"CREATE TABLE ZeroKey (Id int); INSERT ZeroKey VALUES (NULL)"); using (var context = new NullKeyContext(testStore.Connection.ConnectionString)) { Assert.Equal( RelationalStrings.InvalidKeyValue("ZeroKey"), Assert.Throws <InvalidOperationException>(() => context.ZeroKeys.ToList()).Message); } } }