public async Task GetSilentlyAuthenticatedClientAsync_ServiceResourceRequired() { bool exceptionThrown = false; try { var client = await BusinessClientExtensions.GetSilentlyAuthenticatedClientAsync( new AppConfig { ActiveDirectoryAppId = "appId", }, "refreshToken", this.credentialCache, this.httpProvider); } catch (OneDriveException exception) { Assert.AreEqual(OneDriveErrorCode.AuthenticationFailure.ToString(), exception.Error.Code, "Unexpected error thrown."); Assert.AreEqual("ActiveDirectoryServiceResource is required for silently authenticating a business client.", exception.Error.Message, "Unexpected error thrown."); exceptionThrown = true; } Assert.IsTrue(exceptionThrown, "Expected exception not thrown."); }
public async Task GetSilentlyAuthenticatedClientAsync_RefreshTokenRequired() { try { var client = await BusinessClientExtensions.GetSilentlyAuthenticatedClientAsync( new BusinessAppConfig { ActiveDirectoryAppId = "appId", ActiveDirectoryServiceResource = "https://localhost/resource/" }, /* refreshToken */ null, this.credentialCache.Object, this.httpProvider.Object); } catch (OneDriveException exception) { Assert.AreEqual(OneDriveErrorCode.AuthenticationFailure.ToString(), exception.Error.Code, "Unexpected error thrown."); Assert.AreEqual("Refresh token is required for silently authenticating a business client.", exception.Error.Message, "Unexpected error thrown."); throw; } }