示例#1
0
        public async Task ReadsFile()
        {
            // Make sure we read and write the same filename.
            string guid = string.Format("{0}", Guid.NewGuid());

            // Write a file so we can read it back.
            await WritesFile(guid);

            // 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
            };

            // CacheStream creates a temp file, and deletes the file upon closing. You can debug and inspect it if you want.
            using (var stream = new CacheStream())
            {
                var info = await dropbox.ReadAsync(stream, string.Format("HelloDropbox.{0}.html", guid));

                // Make sure we get info back
                Assert.IsNotNull(info);
                // Make sure there is content.
                Assert.IsTrue(info.Length > 0);
            }
        }