public void Modifying_QueryArgs_Should_Update_Query_And_ToString_Test() { var uri = new UriFormatter("http://localhost"); Assert.That(string.IsNullOrEmpty(uri.Query)); Assert.That(uri.QueryArgs.Count == 0); Assert.That(uri.ToString() == "http://localhost/"); uri.QueryArgs.Add("orderBy", "name"); Assert.That(uri.Query == "orderBy=name"); Assert.That(uri.QueryArgs.Count == 1); Assert.That(uri.ToString() == "http://localhost/?orderBy=name"); uri.QueryArgs.Clear(); Assert.That(string.IsNullOrEmpty(uri.Query)); Assert.That(uri.QueryArgs.Count == 0); Assert.That(uri.ToString() == "http://localhost/"); }
public void Support_Uri_Fragments_Test() { var uri = new UriFormatter("http://m6400/sdata/-/-/-/#one"); Assert.That(uri.Fragment, Is.EqualTo("one")); uri.Host = "localhost"; Assert.That(uri.Fragment, Is.EqualTo("one")); uri.Fragment = "two"; StringAssert.EndsWith("#two", uri.ToString()); }