@@ -453,7 +453,7 @@ public void ScopedResolve_ScopedDependsOnTransient_ActivationException()
453453 // Act && Assert
454454
455455 var ex = Assert . Throws < ActivationException > ( ( ) => scope . Resolver . Resolve < IFoo > ( ) ) ;
456- Assert . That ( ex . Message , Does . StartWith ( "A lifestyle mismatch has been detected. Foo (Async Scoped) depends on IBar implemented by Bar (Transient). ") ) ;
456+ Assert . That ( ex . Message , Does . Contain ( "[Lifestyle Mismatch] Foo (Async Scoped) depends on IBar implemented by Bar (Transient)") ) ;
457457 }
458458 }
459459
@@ -561,14 +561,13 @@ public void ScopedResolve_SingletonDependsOnScoped_ActivationException()
561561 _provider . Register < IBar , Bar > ( ) ;
562562 _provider . Register < IFoo , Foo > ( LifetimeType . Singleton ) ;
563563
564- using ( var scope = _provider . BeginLifetimeScope ( ) )
565- {
566- // Act && Assert
564+ using var scope = _provider . BeginLifetimeScope ( ) ;
567565
568- var ex = Assert . Throws < ActivationException > ( ( ) => scope . Resolver . Resolve < IFoo > ( ) ) ;
569- Assert . That ( ex . Message ,
570- Does . StartWith ( "A lifestyle mismatch has been detected. Foo (Singleton) depends on IBar implemented by Bar (Async Scoped)." ) ) ;
571- }
566+ // Act && Assert
567+
568+ var ex = Assert . Throws < ActivationException > ( ( ) => scope . Resolver . Resolve < IFoo > ( ) ) ;
569+ Assert . That ( ex . Message ,
570+ Does . Contain ( "[Lifestyle Mismatch] Foo (Singleton) depends on IBar implemented by Bar (Async Scoped)." ) ) ;
572571 }
573572
574573 // Note: this behavior check is not available
@@ -625,14 +624,13 @@ public void ScopedResolve_SingletonDependsOnTransient_ActivationException()
625624 _provider . Register < IBar , Bar > ( LifetimeType . Transient ) ;
626625 _provider . Register < IFoo , Foo > ( LifetimeType . Singleton ) ;
627626
628- using ( var scope = _provider . BeginLifetimeScope ( ) )
629- {
630- // Act && Assert
627+ using var scope = _provider . BeginLifetimeScope ( ) ;
631628
632- var ex = Assert . Throws < ActivationException > ( ( ) => scope . Resolver . Resolve < IFoo > ( ) ) ;
633- Assert . That ( ex . Message ,
634- Does . StartWith ( "A lifestyle mismatch has been detected. Foo (Singleton) depends on IBar implemented by Bar (Transient)." ) ) ;
635- }
629+ // Act && Assert
630+
631+ var ex = Assert . Throws < ActivationException > ( ( ) => scope . Resolver . Resolve < IFoo > ( ) ) ;
632+ Assert . That ( ex . Message ,
633+ Does . Contain ( "[Lifestyle Mismatch] Foo (Singleton) depends on IBar implemented by Bar (Transient)." ) ) ;
636634 }
637635
638636 // Note: this behavior check is not available
0 commit comments