public void Setup()
 {
     this.appConfig = new AppConfig
     {
         ActiveDirectoryAppId = "12345",
         ActiveDirectoryReturnUrl = "https://localhost/return",
         ActiveDirectoryServiceResource = "https://resource/",
     };
     
     this.credentialCache = new MockAdalCredentialCache();
     this.httpProvider = new MockHttpProvider(null);
     this.serviceInfoProvider = new AdalAuthenticationByCodeServiceInfoProvider(authenticationCode) { UserSignInName = "12345" };
 }
        public void Setup()
        {
            this.appConfig = new AppConfig
            {
                ActiveDirectoryAppId           = "12345",
                ActiveDirectoryReturnUrl       = "https://localhost/return",
                ActiveDirectoryServiceResource = "https://resource/",
            };

            this.credentialCache     = new MockAdalCredentialCache();
            this.httpProvider        = new MockHttpProvider(null);
            this.serviceInfoProvider = new AdalAuthenticationByCodeServiceInfoProvider(authenticationCode)
            {
                UserSignInName = "12345"
            };
        }
        public async Task GetServiceInfo_AuthenticationProviderAlreadySet()
        {
            var authenticationProvider = new MockAuthenticationProvider();

            this.serviceInfoProvider = new AdalAuthenticationByCodeServiceInfoProvider(
                authenticationCode,
                authenticationProvider.Object);

            var serviceInfo = await this.serviceInfoProvider.GetServiceInfo(
                this.appConfig,
                this.credentialCache.Object,
                this.httpProvider.Object,
                ClientType.Business);

            Assert.IsNotInstanceOfType(
                serviceInfo.AuthenticationProvider,
                typeof(AdalAuthenticationByCodeServiceInfoProvider),
                "Unexpected authentication provider type.");

            Assert.AreEqual(authenticationProvider.Object, serviceInfo.AuthenticationProvider, "Unexpected authentication provider set.");
        }
        public async Task GetServiceInfo_AuthenticationProviderAlreadySet()
        {
            var authenticationProvider = new MockAuthenticationProvider();
            this.serviceInfoProvider = new AdalAuthenticationByCodeServiceInfoProvider(
                authenticationCode,
                authenticationProvider.Object);

            var serviceInfo = await this.serviceInfoProvider.GetServiceInfo(
                this.appConfig,
                this.credentialCache.Object,
                this.httpProvider.Object,
                ClientType.Business);

            Assert.IsNotInstanceOfType(
                serviceInfo.AuthenticationProvider,
                typeof(AdalAuthenticationByCodeServiceInfoProvider),
                "Unexpected authentication provider type.");

            Assert.AreEqual(authenticationProvider.Object, serviceInfo.AuthenticationProvider, "Unexpected authentication provider set.");
        }