@@ -275,7 +275,7 @@ public void StartTransaction_should_call_coreSession()
275275
276276 subject . StartTransaction ( transactionOptions ) ;
277277
278- Mock . Get ( subject . WrappedCoreSession ) . Verify ( m => m . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) , Times . Once ) ;
278+ Mock . Get ( subject . WrappedCoreSession ) . As < ICoreSessionInternal > ( ) . Verify ( m => m . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) , Times . Once ) ;
279279 }
280280
281281 [ Theory ]
@@ -405,7 +405,7 @@ public void WithTransaction_callback_should_be_processed_with_expected_result(
405405 mockCoreSession . Verify( handle => handle . CommitTransaction ( It . IsAny < CancellationToken > ( ) ) , Times. Exactly ( expectedCommitTransactionAttempts ) ) ;
406406 }
407407
408- mockCoreSession . Verify ( handle => handle. StartTransaction( It. IsAny< TransactionOptions> ( ) ) , Times . Exactly( expectedStartTransactionAttempts ) ) ;
408+ mockCoreSession . As < ICoreSessionInternal > ( ) . Verify ( handle => handle. StartTransaction( It. IsAny< TransactionOptions> ( ) , It . IsAny < bool > ( ) ) , Times . Exactly( expectedStartTransactionAttempts ) ) ;
409409 }
410410
411411 [ Theory ]
@@ -428,7 +428,7 @@ public void WithTransaction_callback_with_a_custom_error_should_not_be_retried()
428428
429429 Assert . Throws < MongoException > ( ( ) => subject . WithTransaction < bool > ( ( handle , cancellationToken ) => throw new MongoException ( "test" ) ) ) ;
430430
431- mockCoreSession . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) , Times . Once ) ;
431+ mockCoreSession . As < ICoreSessionInternal > ( ) . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) , Times . Once ) ;
432432 mockCoreSession . Verify ( handle => handle . CommitTransaction ( It . IsAny < CancellationToken > ( ) ) , Times . Never ) ;
433433 }
434434
@@ -595,7 +595,7 @@ public void WithTransaction_with_error_in_callback_should_call_AbortTransaction_
595595
596596 Assert . Throws < Exception > ( ( ) => subject . WithTransaction < object > ( ( handle , cancellationToken ) => throw new Exception ( "test" ) ) ) ;
597597
598- mockCoreSession . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) , Times . Once ) ;
598+ mockCoreSession . As < ICoreSessionInternal > ( ) . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) , Times . Once ) ;
599599 mockCoreSession . Verify ( handle => handle . AbortTransaction ( It . IsAny < CancellationToken > ( ) ) , shouldAbortTransactionBeCalled ? Times . Once ( ) : Times . Never ( ) ) ;
600600 mockCoreSession . Verify ( handle => handle . CommitTransaction ( It . IsAny < CancellationToken > ( ) ) , Times . Never ) ;
601601 }
@@ -604,13 +604,13 @@ public void WithTransaction_with_error_in_callback_should_call_AbortTransaction_
604604 public void WithTransaction_with_error_in_StartTransaction_should_return_control_immediately ( )
605605 {
606606 var mockCoreSession = CreateCoreSessionMock ( ) ;
607- mockCoreSession
608- . Setup ( c => c . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) )
607+ mockCoreSession . As < ICoreSessionInternal > ( )
608+ . Setup ( c => c . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) )
609609 . Throws < Exception > ( ) ;
610610 var subject = CreateSubject ( coreSession : mockCoreSession . Object ) ;
611611
612612 Assert . Throws < Exception > ( ( ) => subject . WithTransaction < object > ( ( handle , cancellationToken ) => 1 ) ) ;
613- mockCoreSession . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) , Times . Once ) ;
613+ mockCoreSession . As < ICoreSessionInternal > ( ) . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) , Times . Once ) ;
614614 mockCoreSession . Verify ( handle => handle . AbortTransaction ( It . IsAny < CancellationToken > ( ) ) , Times . Never ) ;
615615 mockCoreSession . Verify ( handle => handle . CommitTransaction ( It . IsAny < CancellationToken > ( ) ) , Times . Never ) ;
616616 }
@@ -625,7 +625,7 @@ public void WithTransaction_without_errors_should_call_transaction_infrastructur
625625
626626 subject . WithTransaction < object > ( ( handle , cancellationToken ) => 1 ) ;
627627
628- mockCoreSession . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) ) , Times . Once ) ;
628+ mockCoreSession . As < ICoreSessionInternal > ( ) . Verify ( handle => handle . StartTransaction ( It . IsAny < TransactionOptions > ( ) , It . IsAny < bool > ( ) ) , Times . Once ) ;
629629 mockCoreSession . Verify ( handle => handle . CommitTransaction ( It . IsAny < CancellationToken > ( ) ) , Times . Once ) ;
630630 }
631631
@@ -638,6 +638,7 @@ private Mock<ICoreSessionHandle> CreateCoreSessionMock(
638638 options = options ?? new CoreSessionOptions ( ) ;
639639
640640 var mockCoreSession = new Mock < ICoreSessionHandle > ( ) ;
641+ mockCoreSession . As < ICoreSessionInternal > ( ) ;
641642 mockCoreSession . Setup ( m => m . CurrentTransaction ) . Returns ( new CoreTransaction ( It . IsAny < long > ( ) , It . IsAny < TransactionOptions > ( ) ) ) ;
642643 mockCoreSession . SetupGet ( m => m . Options ) . Returns ( options ) ;
643644 mockCoreSession . SetupGet ( m => m . ServerSession ) . Returns ( serverSession ) ;
0 commit comments