public void Generic_DbRawSqlQuery_ToString_returns_the_query_but_not_the_parameters() { var query = new DbRawSqlQuery <FakeEntity>( MockHelper.CreateInternalSqlSetQuery("select * from Products where Id < {0} and CategoryId = '{1}'", 4, "Beverages")); Assert.Equal("select * from Products where Id < {0} and CategoryId = '{1}'", query.ToString()); }
public void Non_generic_DbRawSqlQuery_GetList_throws_indicating_that_binding_to_queries_is_not_allowed() { var query = new DbRawSqlQuery(MockHelper.CreateInternalSqlSetQuery("query")); Assert.Equal( Strings.DbQuery_BindingToDbQueryNotSupported, Assert.Throws <NotSupportedException>(() => ((IListSource)query).GetList()).Message); }
public void Non_generic_ToListAsync_throws_OperationCanceledException_if_task_is_cancelled() { var query = new DbRawSqlQuery(MockHelper.CreateInternalSqlSetQuery("query", false, 1, 2)); Assert.Throws <OperationCanceledException>( () => query.ToListAsync(new CancellationToken(canceled: true)) .GetAwaiter().GetResult()); }
public void DbRawSqlQuery_ContainsListCollection_returns_false() { var query = new DbRawSqlQuery <FakeEntity>(MockHelper.CreateInternalSqlSetQuery("query")); Assert.False(((IListSource)query).ContainsListCollection); }
public void Generic_DbRawSqlQuery_ToString_returns_the_query() { var query = new DbRawSqlQuery <FakeEntity>(MockHelper.CreateInternalSqlSetQuery("select * from products")); Assert.Equal("select * from products", query.ToString()); }
public void Non_generic_DbSqlQuery_AsStreaming_returns_new_object_with_streaming_flag_set() { var query = new DbRawSqlQuery(MockHelper.CreateInternalSqlSetQuery("query", false, 1, 2)); DynamicAsStreamingTest(query); }
public void Generic_DbSqlQuery_AsNoTracking_returns_new_object_with_no_tracking_flag_set() { var query = new DbSqlQuery <FakeEntity>(MockHelper.CreateInternalSqlSetQuery("query", false, false, 1, 2)); DynamicNoTrackingTest(query); }