File tree Expand file tree Collapse file tree
src/IoTHub.Portal.Tests.Unit/UnitTests/Bases Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,12 +5,11 @@ namespace IoTHub.Portal.Tests.Unit.UnitTests.Bases
55{
66 public abstract class BlazorUnitTest : TestContextWrapper , IDisposable
77 {
8- protected virtual MockRepository MockRepository { get ; set ; }
9-
8+ protected virtual MockRepository MockRepository { get ; set ; }
109 protected virtual MockHttpMessageHandler MockHttpClient { get ; set ; }
11-
12- protected virtual AutoFixture . Fixture Fixture { get ; } = new ( ) ;
10+ protected virtual AutoFixture . Fixture Fixture { get ; } = new ( ) ;
1311 protected Mock < IPermissionsService > mockPermissionsService ;
12+ protected TestAuthorizationContext authContext ;
1413
1514 [ SetUp ]
1615 public virtual void Setup ( )
@@ -26,6 +25,10 @@ public virtual void Setup()
2625 // Add Mock Http Client
2726 MockHttpClient = Services . AddMockHttpClient ( ) ;
2827
28+ // Add authentication context
29+ this . authContext = TestContext ? . AddTestAuthorization ( ) ;
30+ _ = this . authContext ? . SetAuthorized ( Guid . NewGuid ( ) . ToString ( ) ) ;
31+
2932 // Setup mock Permissions service
3033 this . mockPermissionsService = MockRepository . Create < IPermissionsService > ( ) ;
3134 _ = Services . AddSingleton ( this . mockPermissionsService . Object ) ;
You can’t perform that action at this time.
0 commit comments