Exemplo n.º 1
0
 public void BasicRouting_ShouldWork()
 {
     Setup();
     try
     {
         var counter = 0;
         var x = new TestRouter();
         x.Route("counter", e => counter++);
         x.Initialise();
         _location.Replace("http://www.example.com#counter");
         _history.CheckUrl();
         Assert.AreEqual(counter, 1, "expect counter to have incremented");
     }
     finally
     {
         Teardown();
     }
 }
Exemplo n.º 2
0
 public void BasicRouting_WithMultipleParameters_ShouldWork()
 {
     Setup();
     try
     {
         JsDictionary<string, string> routeParams = null;
         var x = new TestRouter();
         x.Route("search/:term/p:page", e => routeParams = e);
         x.Initialise();
         _location.Replace("http://www.example.com#search/hello/p2");
         _history.CheckUrl();
         Assert.AreEqual(routeParams["term"], "hello");
         Assert.AreEqual(routeParams["page"], "2");
     }
     finally
     {
         Teardown();
     }
 }
Exemplo n.º 3
0
 public void BasicRouting_WithMultipleParameters_ViaNavigate_ShouldWork()
 {
     Setup();
     try
     {
         JsDictionary<string, string> routeParams = null;
         var x = new TestRouter();
         x.Route("search/:term/p:page", e => routeParams = e);
         x.Initialise();
         _history.Navigate("search/hello/p2", new RouteNavigateOptions {TriggerCallback = true});
         Assert.AreEqual(routeParams["term"], "hello");
         Assert.AreEqual(routeParams["page"], "2");
     }
     finally
     {
         Teardown();
     }
 }