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()); }
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()); }
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")); }