Beispiel #1
0
        public void TestSaveToFileFail()
        {
            _conn.UserCreds.AuthToken = "fail";
            Container container = new CF_Container(_conn, _client, "foo");

            Assert.Throws <CloudFilesException>(() => container.GetObject("foo"));
            StorageObject obj       = new CF_Object(_conn, container, _client, "foo");
            string        file_name = Path.GetTempFileName();

            Assert.Throws <CloudFilesException>(() => obj.SaveToFile(file_name, true));
            File.Delete(file_name);
        }
Beispiel #2
0
        public void TestSaveToFile()
        {
            Container     container = new CF_Container(_conn, _client, "foo");
            StorageObject obj       = new CF_Object(_conn, container, _client, "foo");
            var           file_name = Path.GetTempFileName();

            obj.SaveToFile(file_name, true);
            var reader   = File.OpenText(file_name);
            var contents = reader.ReadToEnd();

            Assert.AreEqual(contents, "a");
            File.Delete(file_name);
        }
 public void TestFailSaveToObject()
 {
     _conn.UserCreds.AuthToken = "fail-get-object";
     Container container = new CF_Container(_conn, _client, "foo");
     StorageObject obj = new CF_Object(_conn, container, _client, "foo");
     obj.Retries = 1;
     string file_name = Path.GetTempFileName();
     obj.SaveToFile(file_name, true);
     StreamReader reader = File.OpenText(file_name);
     string contents = reader.ReadToEnd();
     Assert.AreEqual(contents, "a");
     File.Delete(file_name);
 }
Beispiel #4
0
        public void TestFailSaveToObject()
        {
            _conn.UserCreds.AuthToken = "fail-get-object";
            Container     container = new CF_Container(_conn, _client, "foo");
            StorageObject obj       = new CF_Object(_conn, container, _client, "foo");

            obj.Retries = 1;
            string file_name = Path.GetTempFileName();

            obj.SaveToFile(file_name, true);
            StreamReader reader   = File.OpenText(file_name);
            string       contents = reader.ReadToEnd();

            Assert.AreEqual(contents, "a");
            File.Delete(file_name);
        }
 public void TestSaveToFile()
 {
     Container container = new CF_Container(_conn, _client, "foo");
     StorageObject obj = new CF_Object(_conn, container, _client, "foo");
     var file_name = Path.GetTempFileName();
     obj.SaveToFile(file_name, true);
     var reader = File.OpenText(file_name);
     var contents = reader.ReadToEnd();
     Assert.AreEqual(contents, "a");
     File.Delete(file_name);
 }
 public void TestSaveToFileFail()
 {
     _conn.UserCreds.AuthToken = "fail";
     Container container = new CF_Container(_conn, _client, "foo");
     Assert.Throws<CloudFilesException>(() => container.GetObject("foo"));
     StorageObject obj = new CF_Object(_conn, container, _client, "foo");
     string file_name = Path.GetTempFileName();
     Assert.Throws<CloudFilesException>(() => obj.SaveToFile(file_name, true));
     File.Delete(file_name);
 }