public void NullPasswordInConstructor() { string baseUri = "http://sonarqube.test.de/"; string username = "******"; string password = null; SqAuthValidationUriBuilder uri = new SqAuthValidationUriBuilder(baseUri, username, password); string expectedBaseUri = "http://sonarqube.test.de/api/authentication/validate"; Assert.AreEqual(expectedBaseUri, uri.GetSqUri().ToString()); }
public void UriIsSetCorrect() { string baseUri = "http://sonarqube.test.de/"; string username = "******"; string password = "******"; SqAuthValidationUriBuilder uri = new SqAuthValidationUriBuilder(baseUri, username, password); string expectedBaseUri = "http://" + username + ":" + password + "@" + "sonarqube.test.de/api/authentication/validate"; Assert.AreEqual(expectedBaseUri, uri.GetSqUri().ToString()); }
public void IsQueryAppendedCorrect() { string baseUri = "http://sonarqube.test.de/"; string username = "******"; string password = "******"; string query = "key=value"; SqAuthValidationUriBuilder uri = new SqAuthValidationUriBuilder(baseUri, username, password); uri.AppendToQuery(query); string expectedBaseUri = "http://" + username + ":" + password + "@" + "sonarqube.test.de/api/authentication/validate"; Assert.AreEqual(expectedBaseUri + "?" + query, uri.GetSqUri().ToString()); }
public void IsPathAppendedCorrect() { string baseUri = "http://sonarqube.test.de/"; string username = "******"; string password = "******"; string toAppend = "some/path/"; SqAuthValidationUriBuilder uri = new SqAuthValidationUriBuilder(baseUri, username, password); uri.AppendToPath(toAppend); string expectedBaseUri = "http://" + username + ":" + password + "@" + "sonarqube.test.de/api/authentication/validate/"; Assert.AreEqual(expectedBaseUri + toAppend, uri.GetSqUri().ToString()); }