public void Test_Authenticates_SP_MixedCredentials() { var auth = new AzureTokenAuthentication(new ServicePrincipleAuth { AppSecret = "test1", TenantId = "test1", AppId = "test1" }); Assert.Throws <AdalServiceException>(() => auth.AccessToken); }
public void Test_Authenticates_SP_MixedCredentials() { var config = new ConfigurationBuilder().AddJsonFile("appSettings.json").Build(); var auth = new AzureTokenAuthentication(new ServicePrincipleAuth { AppSecret = config.GetValue <string>("AppSecret"), TenantId = config.GetValue <string>("TenantId"), AppId = config.GetValue <string>("AppId") }); auth.Name.Should().NotBeNullOrEmpty(); auth.AccessToken.Should().NotBe(null); auth.AccessToken.BearerToken.Should().NotBe(null); auth.AccessToken.BearerToken.Length.Should().BeGreaterThan(0); auth.AccessToken.HasExpired.Should().BeFalse(); auth.AccessToken.Expires.Should().BeMoreThan(DateTime.Now.TimeOfDay); }