Exemplo n.º 1
0
        public async Task DownloadFile_ResultNotNullAsync()
        {
            //Given
            authProvider.Scopes = new[] { AuthProvider.Permissions.Files.Read };
            var item = (await graphManager.SearchDriveAsync("LICENSE.txt")).CurrentPage.First();
            //When
            var stream = await graphManager.GetFileAsync(item.Id);

            string content;

            using var reader = new StreamReader(stream);
            content          = reader.ReadToEnd();
            Debug.WriteLine(content);
            //Then
            Assert.True(!string.IsNullOrEmpty(content));
        }
Exemplo n.º 2
0
        public void DownloadFile_ResultNotNull()
        {
            //Given
            authProvider.Scopes = new[] { Permissions.Files.Read };
            var item = graphManager.SearchDriveAsync("LICENSE.txt").Result.CurrentPage.First();
            //When
            var    stream = graphManager.GetFileAsync(item.Id).Result;
            string content;

            using (var reader = new StreamReader(stream)) {
                content = reader.ReadToEnd();
                Console.WriteLine(content);
            }
            //Then
            Assert.True(!string.IsNullOrEmpty(content));
        }