public void SetQueryTest() { UriBuilder uriBuilder = new UriBuilder("http://", "mccoysoftware.uk"); // Note the absence of a '?' character uriBuilder.SetQuery("Title=Mr&FirstName=Arthur&Surname=Dent"); Assert.AreEqual("http://mccoysoftware.uk/?Title=Mr&FirstName=Arthur&Surname=Dent", uriBuilder.ToString()); // Now WITH a '?' uriBuilder.SetQuery("?Title=Mr&FirstName=Ford&Surname=Prefect"); Assert.AreEqual("http://mccoysoftware.uk/?Title=Mr&FirstName=Ford&Surname=Prefect", uriBuilder.ToString()); }