public void m_FindMetadata_FolderinRoot() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ) { Email = AppTesting.CorrectCredential[2].Email, Password = AppTesting.CorrectCredential[2].Password, }; api.Login(); Metadata mtd = api.RootMeatadata.FindMetadata( "test" ); Assert.IsNotNull( mtd ); }
public void e_LoginFailedEvent() { string incorrectMail = AppTesting.GenerateContact( false, "@" ).email; QApi api = new QApi( AppTesting.CorrectCredential[2].Host, incorrectMail, AppTesting.CorrectCredential[2].Password ); bool apear = false; api.LoginFailedEvent += delegate { apear = true; }; api.Login(); Assert.IsTrue( apear ); }
public void m_IsFile() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ) { Email = AppTesting.CorrectCredential[2].Email, Password = AppTesting.CorrectCredential[2].Password, }; api.Login(); bool isFile = api.RootMeatadata.FindMetadata( "test_file(1).jpg" ).IsFile(); Assert.IsTrue( isFile ); }
public void m_IsDirectory() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ) { Email = AppTesting.CorrectCredential[2].Email, Password = AppTesting.CorrectCredential[2].Password, }; api.Login(); bool isDir = api.RootMeatadata.FindMetadata( "test" ).IsDirectory(); Assert.IsTrue( isDir ); }
public void c_QApi_Init_Default() { QApi api = new QApi(AppTesting.CorrectCredential[2].Host); Assert.IsNotNull( api ); }
public void c_QApi_Init_3Params() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host, AppTesting.CorrectCredential[2].Email, AppTesting.CorrectCredential[2].Password ); Assert.IsNotNull( api ); }
public void m_ValidateFields_3Params__corr() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ); string host = "maytech.quatrix.it"; string email = "*****@*****.**"; string password = "******"; bool valid = api.ValidateFields( host, email, password ); Assert.IsTrue( valid ); }
public void m_LoginWithParametrizedConstructor() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host, AppTesting.CorrectCredential[2].Email, AppTesting.CorrectCredential[2].Password ); bool logined = api.Login(); Assert.IsTrue( logined ); }
public void m_LoginWithEmptyConstructor() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ) { Email = AppTesting.CorrectCredential[2].Email, Password = AppTesting.CorrectCredential[2].Password, }; bool logined = api.Login(); Assert.IsTrue( logined ); }
static void Main( string[] args ) { //-----------------------------------------declare user parameters-------------------------------------- string host = string.Empty; string email = string.Empty; string password = string.Empty; if (args.Length < 3) { Console.Write("Host: "); host = Console.ReadLine(); Console.Write( "Email: " ); email = Console.ReadLine(); Console.Write( "Password: "******"Input paths to files or directory to upload on Quatrix cloud (split them by space or ,)" ); string pathline = Console.ReadLine(); if (string.IsNullOrEmpty( pathline )) { Console.WriteLine( "Incorrect input!"); Console.ReadKey( true ); return; } paths = pathline.Split( new char[] { ' ', '\"', ',' }, StringSplitOptions.RemoveEmptyEntries ); } else { int lenght = args.Length - 3; Array.Copy( args, 3, paths = new string[lenght], 0, lenght ); } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); //-----------------------------------------------AUTH----------------------------------------------------------- QApi api = new QApi( host, email, password ); api.KeepAlive = false; if (!api.Login()) { Console.WriteLine( "Incorrect user credentials!" ); Console.ReadKey( true ); return; } Console.WriteLine( "User {0} is logged in", api.Profile.realname ); Console.WriteLine( "Start upload" ); Metadata dir = api.RootMeatadata; Console.WriteLine(); //-----------------------------------------Upload-------------------------------------------------------------------- foreach (string arg in paths) { Console.WriteLine( "Local path: {0}", arg ); using (var uploader = UploadFactory.GetUploader( arg )) { uploader.UploadProgressChanged += ( o, e ) => { Console.Write( "\rPROGRESS {0}%\tUPLOADED {1}\tTOTAL SIZE {2}", e.Percent, e.FormatedBytesUploaded, e.FormatedFileSize ); }; var result = dir.Upload( uploader ); Console.WriteLine( "{1}ID={0}{1}NAME={2}{1}", result.id, Environment.NewLine, result.name ); } } //================================================================================================================== stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = string.Format( "{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10 ); Console.WriteLine( "Run time: {0}", elapsedTime ); Console.ReadKey( true ); }
public void m_MakeDir() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ) { Email = AppTesting.CorrectCredential[2].Email, Password = AppTesting.CorrectCredential[2].Password, }; api.Login(); Metadata mtd = api.RootMeatadata.MakeDir( "tets1" ); Metadata finded = api.RootMeatadata.FindMetadata( mtd.name ); Assert.IsNotNull( finded ); }
public void m_ValidateFields_Default_EmptyConstructor() { QApi api = new QApi( AppTesting.CorrectCredential[2].Host ); string resmessage = ""; try { api.ValidateFields(); } catch (Exception ex) { resmessage = ex.Message; } Assert.AreEqual( Error.api_email_invalid, resmessage ); }
public void m_Login_EmptyCredentials() { string message = Error.api_host_invalid; string resmessage = ""; try { QApi api = new QApi( string.Empty ) { Email = AppTesting.EmptyCredential.Email, Password = AppTesting.EmptyCredential.Password }; api.Login(); } catch (Exception ex) { resmessage = ex.Message; } Assert.AreEqual<string>( message, resmessage ); }