Пример #1
0
        public GooglePhotosClientTests()
        {
            this.httpClient     = new Mock <HttpClient>();
            this.userCredential = new Mock <UserCredential>();
            GooglePhotosClientSettings clientSettings = new GooglePhotosClientSettings(
                this.httpClient.Object,
                this.userCredential.Object);

            this.googlePhotosClient = new GooglePhotosClient(clientSettings);
        }
        public GooglePhotosClientIntegrationTests()
        {
            HttpClient     httpClient = new HttpClient();
            UserCredential userCredential;

            using (var stream = new FileStream("credentialsPhoto.json", FileMode.Open, FileAccess.Read))
            {
                userCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    GoogleClientSecrets.Load(stream).Secrets,
                    new[] { "https://www.googleapis.com/auth/photoslibrary.readonly" },
                    userEmail,
                    CancellationToken.None).Result;
            }

            userCredential.RefreshTokenAsync(CancellationToken.None).Wait();
            GooglePhotosClientSettings clientSettings = new GooglePhotosClientSettings(httpClient, userCredential);

            this.googlePhotosClient = new GooglePhotosClient(clientSettings);
        }
Пример #3
0
 public GooglePhotosClient(GooglePhotosClientSettings clientSettings)
 {
     this.clientSettings = clientSettings;
 }