static void Main(string[] args) { Options options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { QiniuConfig conf = new QiniuConfig("Wege4i-gz1IyWpCEfjhfEjZDj9U7IAhCXwq5FzxP", "l9DlUgST1KhGInpA--QMqeY3sLmaQ6nBCp_HOpH9", "7xosys.com1.z0.glb.clouddn.com", "notebook"); QiniuFile qiniu = new QiniuFile(conf, "D:/"); qiniu.init(); try { // 创建文件 FileStream fs = new FileStream("uploadtest", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("uploadtest"); sw.Close(); qiniu.Upload("uploadtest", true); File.Delete("uploadtest"); } catch (Exception e) { if (File.Exists("uploadtest")) File.Delete("uploadtest"); return; } Console.WriteLine(options.SaveDir); } else { ; } }
void Upload_FileNotExists(QiniuFile qiniu) { try { qiniu.Upload(""); } catch (Exception e) { StringAssert.Contains(e.Message, "Error: Upload failed. File not Exists"); return; } Assert.Fail("No exception was thrown."); }