コード例 #1
0
        public void TokenMintingService_ToArbitraryResourceOwnerRequest_clientIds_all_null()
        {
            var fakeConfiguration = A.Fake <IConfiguration>();

            A.CallTo(() => fakeConfiguration["inProcTokenMintingService:clientId"]).Returns(null);
            var inProcTokenMintingService = new InProcTokenMintingService(fakeConfiguration, null, null);

            Should.Throw <Exception>(() =>
            {
                inProcTokenMintingService.ToArbitraryResourceOwnerRequest(new ResourceOwnerTokenRequest()
                {
                    ClientId            = null,
                    AccessTokenLifetime = 2,
                    Subject             = GuidString,
                    Scope = $"a b c"
                });
            });
            Should.Throw <Exception>(() =>
            {
                inProcTokenMintingService.ToArbitraryResourceOwnerRequest(null);
            });
        }
コード例 #2
0
        public void TokenMintingService_ToArbitraryResourceOwnerRequest_valid_clientId()
        {
            var fakeConfiguration = A.Fake <IConfiguration>();

            A.CallTo(() => fakeConfiguration["inProcTokenMintingService:clientId"]).Returns(GuidString);
            var inProcTokenMintingService = new InProcTokenMintingService(fakeConfiguration, null, null);
            var d = inProcTokenMintingService.ToArbitraryResourceOwnerRequest(new ResourceOwnerTokenRequest()
            {
                AccessTokenLifetime = 2,
                Subject             = GuidString,
                Scope = $"a b c"
            });

            d.ShouldNotBeNull();
        }