示例#1
0
        public async Task WritesFile(string guid = null)
        {
            if (guid == null)
            {
                guid = string.Format("{0}", Guid.NewGuid());
            }

            // Manually set the test credential; in the real-world, QBO will store them in it's CredentialCache.
            var dropbox = new Dropbox(Config, null)
            {
                Credential = credential
            };

            using (var stream = new CacheStream("Samples/HelloDropbox.html", System.IO.FileMode.Open, System.IO.FileAccess.Read))
            {
                // Make sure we have a unique file, so folks can see the new file in Dropbox
                var info = await dropbox.WriteAsync(stream, string.Format("HelloDropbox.{0}.html", guid));

                Assert.IsNotNull(info);
            }
        }