public IDriveService Create()
        {
            const string applicationName = "GoogleDriveOfflineBackup";
            var scopes = new[] { DriveService.Scope.DriveReadonly };
            UserCredential credential;
            Console.WriteLine("Searching for settings file");
            CredentialsProvider credentialsProvider = new CredentialsProvider();
            string secretFile = credentialsProvider.LocateSettingsFile();
            using (var stream = new FileStream(secretFile, FileMode.Open, FileAccess.Read))
            {
                string personalPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                string credentialsPath = Path.Combine(personalPath, ".credentials");
                string appCredentialsPath = Path.Combine(credentialsPath, "GoogleDriveOfflineBackup");
                Console.WriteLine("Authorizing {0}", appCredentialsPath);
                var secrets = GoogleClientSecrets.Load(stream).Secrets;
                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
                    secrets,
                    scopes,
                    "user",
                    CancellationToken.None,
                    new FileDataStore(appCredentialsPath, fullPath: true)).Result; // blocking!

                Console.WriteLine("Credentials written to {0}", appCredentialsPath);
            }

            // create service
            var service = new DriveService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName = applicationName
            });

            return new DriveServiceWrapper(service);
        }
 public void SetUp()
 {
     mockFileSystem = Utils.CreateStubFileSystem(MockBehavior.Default);
     provider = new CredentialsProvider(mockFileSystem.Object);
 }