public void UriIsSetCorrect()
    {
        string baseUri    = "http://sonarqube.test.de/";
        string projectKey = "project-key";
        string metrics    = "ncloc,bugs,vulnerabilities";

        SqComponentTreeUriBuilder uri = new SqComponentTreeUriBuilder(baseUri, projectKey, metrics);

        string expectedUri = baseUri + "api/measures/component_tree?baseComponentKey="
                             + projectKey + "&metricKeys=" + metrics;

        Assert.AreEqual(expectedUri, uri.GetSqUri().ToString());
    }
    public void IsPathAppendedCorrect()
    {
        string baseUri                = "http://sonarqube.test.de/";
        string projectKey             = "project-key";
        string metrics                = "ncloc,bugs,vulnerabilities";
        string toAppend               = "some/path/";
        SqComponentTreeUriBuilder uri = new SqComponentTreeUriBuilder(baseUri, projectKey, metrics);

        uri.AppendToPath(toAppend);

        string expectedUri = baseUri + "api/measures/component_tree" + "/" + toAppend
                             + "?baseComponentKey=" + projectKey + "&metricKeys=" + metrics;

        Assert.AreEqual(expectedUri, uri.GetSqUri().ToString());
    }
    public void NullPasswordCredentials()
    {
        string baseUri                = "http://sonarqube.test.de/";
        string projectKey             = "project-key";
        string metrics                = "ncloc,bugs,vulnerabilities";
        string username               = "******";
        string password               = null;
        SqComponentTreeUriBuilder uri = new SqComponentTreeUriBuilder(baseUri, projectKey, metrics);

        uri.UserCredentials(username, password);

        string expectedUri = baseUri + "api/measures/component_tree?baseComponentKey="
                             + projectKey + "&metricKeys=" + metrics;

        Assert.AreEqual(expectedUri, uri.GetSqUri().ToString());
    }
    public void PageSizeIs500()
    {
        string baseUri                = "http://sonarqube.test.de/";
        string projectKey             = "project-key";
        string metrics                = "ncloc,bugs,vulnerabilities";
        int    pageSize               = 500;
        SqComponentTreeUriBuilder uri = new SqComponentTreeUriBuilder(baseUri, projectKey, metrics);

        uri.PageSize(pageSize);

        string expectedUri = baseUri + "api/measures/component_tree"
                             + "?baseComponentKey=" + projectKey + "&metricKeys="
                             + metrics + "&" + "ps=" + pageSize;

        Assert.AreEqual(expectedUri, uri.GetSqUri().ToString());
    }
    public void IsQueryAppendedCorrect()
    {
        string baseUri                = "http://sonarqube.test.de/";
        string projectKey             = "project-key";
        string metrics                = "ncloc,bugs,vulnerabilities";
        string query                  = "key=value";
        SqComponentTreeUriBuilder uri = new SqComponentTreeUriBuilder(baseUri, projectKey, metrics);

        uri.AppendToQuery(query);

        string expectedUri = baseUri + "api/measures/component_tree"
                             + "?baseComponentKey=" + projectKey + "&metricKeys="
                             + metrics + "&" + query;

        Assert.AreEqual(expectedUri, uri.GetSqUri().ToString());
    }