@@ -884,6 +884,7 @@ void SqlCapturer(object sender, DbCommandEventArgs args)
884884 public void SessionTagPrefetchEntitySet ( )
885885 {
886886 var allCommands = new List < string > ( ) ;
887+ var batchesSupported = Domain . Handlers . ProviderInfo . Supports ( Providers . ProviderFeatures . Batches ) ;
887888
888889 using ( var session = Domain . OpenSession ( ) )
889890 using ( var tx = session . OpenTransaction ( ) ) {
@@ -907,8 +908,15 @@ public void SessionTagPrefetchEntitySet()
907908 _ = session . Query . All < Author > ( ) . Prefetch ( a => a . Books ) . ToArray ( ) ;
908909 session . Events . DbCommandExecuting -= SqlCapturer ;
909910
910- Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
911- Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost*/" ) ) ;
911+ if ( batchesSupported ) {
912+ Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
913+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost*/" ) ) ;
914+ }
915+ else {
916+ Assert . That ( allCommands . Count , Is . EqualTo ( 3 ) ) ;
917+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost*/" ) ) ;
918+ Assert . IsTrue ( allCommands [ 2 ] . StartsWith ( "/*outermost*/" ) ) ;
919+ }
912920
913921 allCommands . Clear ( ) ;
914922 }
@@ -922,8 +930,15 @@ public void SessionTagPrefetchEntitySet()
922930 _ = session . Query . All < Author > ( ) . Prefetch ( a => a . Books ) . ToArray ( ) ;
923931 session . Events . DbCommandExecuting -= SqlCapturer ;
924932
925- Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
926- Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between*/" ) ) ;
933+ if ( batchesSupported ) {
934+ Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
935+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between*/" ) ) ;
936+ }
937+ else {
938+ Assert . That ( allCommands . Count , Is . EqualTo ( 3 ) ) ;
939+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between*/" ) ) ;
940+ Assert . IsTrue ( allCommands [ 2 ] . StartsWith ( "/*outermost in-between*/" ) ) ;
941+ }
927942
928943 allCommands . Clear ( ) ;
929944 }
@@ -939,8 +954,15 @@ public void SessionTagPrefetchEntitySet()
939954 _ = session . Query . All < Author > ( ) . Prefetch ( a => a . Books ) . ToArray ( ) ;
940955 session . Events . DbCommandExecuting -= SqlCapturer ;
941956
942- Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
943- Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between deepest*/" ) ) ;
957+ if ( batchesSupported ) {
958+ Assert . That ( allCommands . Count , Is . EqualTo ( 2 ) ) ;
959+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between deepest*/" ) ) ;
960+ }
961+ else {
962+ Assert . That ( allCommands . Count , Is . EqualTo ( 3 ) ) ;
963+ Assert . IsTrue ( allCommands [ 1 ] . StartsWith ( "/*outermost in-between deepest*/" ) ) ;
964+ Assert . IsTrue ( allCommands [ 2 ] . StartsWith ( "/*outermost in-between deepest*/" ) ) ;
965+ }
944966
945967 allCommands . Clear ( ) ;
946968 }
0 commit comments