예제 #1
0
        public void GetExceptionWhenSecurityConfigurationIsNotSet()
        {
            var jwtClient                 = new Mock <IJwtTokenRequestClient>();
            var configuration             = new Mock <ISecurityConfiguration>();
            var securityTokenServiceProxy = new SecurityTokenServiceProxy(jwtClient.Object, configuration.Object);

            Assert.Catch <ApplicationException>(() => securityTokenServiceProxy.GetAccessToken());
        }
예제 #2
0
        public void GetExceptionWhenPartNoneServiceSecurityConfigurationSet()
        {
            var jwtClient     = new Mock <IJwtTokenRequestClient>();
            var configuration = new Mock <ISecurityConfiguration>();

            configuration.Setup(x => x.ClientId).Returns("abc");

            var securityTokenServiceProxy = new SecurityTokenServiceProxy(jwtClient.Object, configuration.Object);

            Assert.Catch <ApplicationException>(() => securityTokenServiceProxy.GetAccessToken());
        }
예제 #3
0
        public void GetAccessTokenWhenAllNoneServiceSecurityConfigurationSet()
        {
            var jwtClient     = new Mock <IJwtTokenRequestClient>();
            var configuration = new Mock <ISecurityConfiguration>();

            configuration.Setup(x => x.ClientId).Returns("abc");
            configuration.Setup(x => x.ClientPassword).Returns("abc");
            configuration.Setup(x => x.ClientScope).Returns("abc");

            jwtClient.Setup(x => x.ProcessByUserProfileId()).Returns(new JwtTokenRequestResult
            {
                AccessToken = "bar"
            });

            var securityTokenServiceProxy = new SecurityTokenServiceProxy(jwtClient.Object, configuration.Object);

            Assert.That(securityTokenServiceProxy.GetAccessToken(), Is.EqualTo("bar"));
        }