コード例 #1
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanGet_EmptyQueryDictionary()
 {
     Url u = new Url("/hello.aspx");
     var q = u.GetQueries();
     Assert.AreEqual(0, q.Count);
 }
コード例 #2
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanGet_Query()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQuery("something");
     Assert.AreEqual("someotherthing", q);
 }
コード例 #3
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_HomePath()
 {
     Url u = new Url("/");
     Assert.AreEqual("/", u.Path);
     Assert.AreEqual("/", u.ToString());
 }
コード例 #4
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_WithBaseSchemeAndRawUrl()
 {
     Url u = new Url("http", "www.n2cms.com", "/Default.aspx?");
     Assert.AreEqual("http", u.Scheme);
     Assert.AreEqual("www.n2cms.com", u.Authority);
     Assert.AreEqual("/Default.aspx", u.PathAndQuery);
 }
コード例 #5
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void Getting_Query_WhenNoQueries_GivesNull()
 {
     Url u = new Url("/hello.aspx");
     var q = u.GetQuery("something");;
     Assert.IsNull(q);
 }
コード例 #6
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void UpdatingQueryToNull_ReturnsOtherParameter_WhenUpdatingSecond()
 {
     Url u = new Url("/hello.aspx?something=someotherthing&query=value");
     u = u.SetQueryParameter("query", null);
     Assert.AreEqual("/hello.aspx?something=someotherthing", u.ToString());
 }
コード例 #7
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_AbsoluteLocalPath_WithQuery_AndFragment()
 {
     Url u = new Url("/hello.aspx?something=someotherthing#somebookmark");
     Assert.AreEqual("/hello.aspx", u.Path);
     Assert.AreEqual("something=someotherthing", u.Query);
     Assert.AreEqual("somebookmark", u.Fragment);
     Assert.AreEqual("/hello.aspx?something=someotherthing#somebookmark", u.ToString());
 }
コード例 #8
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void EmptyUrl()
 {
     Url u = new Url("");
     Assert.AreEqual("", u.Path);
     Assert.AreEqual("", u.ToString());
 }
コード例 #9
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_AbsoluteLocalPath_WithFragment()
 {
     Url u = new Url("/hello.aspx#somebookmark");
     Assert.AreEqual("/hello.aspx", u.Path);
     Assert.AreEqual("somebookmark", u.Fragment);
     Assert.AreEqual("/hello.aspx#somebookmark", u.ToString());
 }
コード例 #10
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_AbsoluteLocalPath_WithQuery()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     Assert.AreEqual("/hello.aspx", u.Path);
     Assert.AreEqual("something=someotherthing", u.Query);
     Assert.AreEqual("/hello.aspx?something=someotherthing", u.ToString());
 }
コード例 #11
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_AbsoluteLocalPath()
 {
     Url u = new Url("/hello.aspx");
     Assert.AreEqual("/hello.aspx", u.Path);
     Assert.AreEqual("/hello.aspx", u.ToString());
 }
コード例 #12
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanClearExtension()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     u = u.SetExtension("");
     Assert.AreEqual("/hello?something=someotherthing", u.ToString());
 }
コード例 #13
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void UpdatingQueryToNull_WhenSingleParameter_RemovesItFromUrl()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     u = u.SetQueryParameter("something", null);
     Assert.AreEqual("/hello.aspx", u.ToString());
 }
コード例 #14
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanGet_QueryDictionary()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQueries();
     Assert.AreEqual(1, q.Count);
     Assert.AreEqual("someotherthing", q["something"]);
 }
コード例 #15
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_FromHostName_WithPath()
 {
     Url u = new Url("http://somesite/some/path");
     Assert.AreEqual("http", u.Scheme);
     Assert.AreEqual("somesite", u.Authority);
     Assert.AreEqual("/some/path", u.Path);
     Assert.AreEqual("http://somesite/some/path", u.ToString());
 }
コード例 #16
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanSplitPath_IntoPathWithoutExtension()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     Assert.AreEqual("/hello", u.PathWithoutExtension);
 }
コード例 #17
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_FromHostName_WithPath_AndQuery_AndFragment()
 {
     Url u = new Url("http://somesite/some/path?key=value#bookmark");
     Assert.AreEqual("http", u.Scheme);
     Assert.AreEqual("somesite", u.Authority);
     Assert.AreEqual("/some/path", u.Path);
     Assert.AreEqual("key=value", u.Query);
     Assert.AreEqual("bookmark", u.Fragment);
     Assert.AreEqual("http://somesite/some/path?key=value#bookmark", u.ToString());
 }
コード例 #18
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void Getting_NonExistantQuery_GivesNull()
 {
     Url u = new Url("/hello.aspx?something=someotherthing");
     var q = u.GetQuery("nothing");
     Assert.IsNull(q);
 }
コード例 #19
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void CanConstruct_FromHostName_WithPort()
 {
     Url u = new Url("http://somesite:8080/");
     Assert.AreEqual("http", u.Scheme);
     Assert.AreEqual("somesite:8080", u.Authority);
     Assert.AreEqual("http://somesite:8080/", u.ToString());
 }
コード例 #20
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void NullUrl()
 {
     Url u = new Url((string)null);
     Assert.AreEqual("", u.Path);
     Assert.AreEqual("", u.ToString());
 }
コード例 #21
0
ファイル: UrlTests.cs プロジェクト: pauldotknopf/Noodle
 public void UpdatingQueryToNull_ReturnsOtherParameters_WhenUpdatingFirst()
 {
     Url u = new Url("/hello.aspx?something=someotherthing&query=value&query3=value3");
     u = u.SetQueryParameter("something", null);
     Assert.AreEqual("/hello.aspx?query=value&query3=value3", u.ToString());
 }