public async Task Upload_File_As_Stream()
        {
            var data = new MemoryStream(Encoding.UTF8.GetBytes("a,b \n c,d"));

            //Create a unique file name
            var fileName = Guid.NewGuid().ToString();

            //Upload a file
            var upload = await _filesApi.UploadAsStreamAsync(fileName, "/", (int)data.Length, data);

            Assert.AreEqual(fileName, upload.Name);
        }
Пример #2
0
        public void UploadAsStreamAsync_EmptyStream_Throws400()
        {
            var data = new MemoryStream();

            //Create a unique file name
            var fileName = Guid.NewGuid().ToString();

            //Upload an empty Stream
            var exception = Assert.ThrowsAsync <ApiException>(() =>
                                                              _filesApi.UploadAsStreamAsync(fileName, "/", (int)data.Length, data));

            Assert.AreEqual(exception.ErrorCode, 400);
        }