public void Constructor() { //Local Assert.Throws <ArgumentNullException>(() => new AutoCheck.Core.Connectors.Rss("")); Assert.Throws <FileNotFoundException>(() => new AutoCheck.Core.Connectors.Rss(GetSampleFile("someFile.ext"))); //Remote const OS remoteOS = OS.GNU; const string host = "localhost"; const string username = "******"; const string password = "******"; Assert.Throws <ArgumentNullException>(() => new AutoCheck.Core.Connectors.Rss(remoteOS, host, username, password, string.Empty)); Assert.Throws <FileNotFoundException>(() => new AutoCheck.Core.Connectors.Rss(remoteOS, host, username, password, _FAKE)); //Note: the source code for local and remote mode are exactly the same, just need to test that the remote file is being downloaded from remote and parsed. var file = LocalPathToWsl(GetSampleFile("correct.rss")); Assert.DoesNotThrow(() => new AutoCheck.Core.Connectors.Rss(OS.GNU, host, username, password, file)); }
/// <summary> /// Loads a remote file into the local collection in order to compare it when Compare() is called. /// </summary> /// <param name="host">Remote OS family.</param> /// <param name="host">Remote host name.</param> /// <param name="username">The username wich will be used to connect with the remote host.</param> /// <param name="password">The password wich will be used to connect with the remote host.</param> /// <param name="password">The SSH port wich will be used to connect with the remote host.</param> /// <param name="path">Path to a file or folder; if the path points to a folder, the first file found using the FilePattern property will be loaded.</param> public virtual void Load(OS os, string host, string username, string password, int port, string path) { if (string.IsNullOrEmpty(host)) { throw new ArgumentNullException("host"); } if (string.IsNullOrEmpty(username)) { throw new ArgumentNullException("username"); } if (string.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } var remote = new Shell(os, host, username, password, port); if (!string.IsNullOrEmpty(Path.GetExtension(path))) { if (!remote.ExistsFile(path)) { throw new FileNotFoundException("path"); } path = remote.DownloadFile(path); Load(Path.GetDirectoryName(path), Path.GetFileName(path)); File.Delete(path); } else { string file = remote.GetFile(path, FilePattern, true); if (string.IsNullOrEmpty(file)) { throw new ArgumentInvalidException($"Unable to find any file using the search pattern '{FilePattern}'."); } path = remote.DownloadFile(path); Load(path); } }
public void Constructor_DoesNotThrow(string file, OS remoteOS, string host, string username, string password) { //Note: the source code for local and remote mode are exactly the same, just need to test that the remote file is being downloaded from remote and parsed. Assert.DoesNotThrow(() => new AutoCheck.Core.Connectors.Zip(remoteOS, host, username, password, LocalPathToWsl(GetSampleFile(file)))); }
public void Constructor_Remote_Throws_FileNotFoundException(string file, OS remoteOS, string host, string username, string password) { Assert.Throws <FileNotFoundException>(() => new AutoCheck.Core.Connectors.Zip(remoteOS, host, username, password, file)); }
/// <summary> /// Loads a remote file into the local collection in order to compare it when Compare() is called. /// </summary> /// <param name="host">Remote OS family.</param> /// <param name="host">Remote host name.</param> /// <param name="username">The username wich will be used to connect with the remote host.</param> /// <param name="password">The password wich will be used to connect with the remote host.</param> /// <param name="password">The SSH port wich will be used to connect with the remote host.</param> public virtual void Load(OS os, string host, string username, string password, string path) { //Just to keep the signature consistent along connectors and other stuff Load(os, host, username, password, 22, path); }
public void Constructor_Remote_Throws_ArgumentNullException(string file, OS remoteOS, string host, string username, string password) { Assert.Throws <ArgumentNullException>(() => new AutoCheck.Core.Connectors.Csv(remoteOS, host, username, password, file)); }
public void TestConnection_Remote_DoesNotThrow(OS remoteOS, string host, string username, string password) { Assert.DoesNotThrow(() => RemoteConnectors[TestContext.CurrentContext.Test.ID].TestConnection()); }
public void TestConnection_Remote_Throws_ConnectionInvalidException(OS remoteOS, string host, string username, string password) { Assert.Throws <ConnectionInvalidException>(() => new AutoCheck.Core.Connectors.Shell(remoteOS, host, username, password).TestConnection()); }
public void Constructor_Remote_DoesNotThrow(OS remoteOS, string host, string username, string password) { Assert.DoesNotThrow(() => new AutoCheck.Core.Connectors.Shell(remoteOS, host, username, password)); }