Parses the given http url.
 public BusinessControllerBase SelectBusinessController(HttpRequestMessage request, ITypeListHost host, INamingConvention convention, IInjectionContainer container)
 {
     UrlParser url = new UrlParser(request.RequestUri.ToString());
     Type controllerType = host.BusinessTypeList[url.BusinessClass];
     var instance = container.Resolve(controllerType);
     return new CrowBusinessController(instance, url, convention);
 }
 public BusinessControllerBase(object instance, UrlParser url, INamingConvention convention)
 {
     _BusinessInstance = instance;
     _BusinessInstance.ThrowIfNull("instance");
     _UrlInformation = url;
     _UrlInformation.ThrowIfNull("url");
     _namingConvention = convention;
     _namingConvention.ThrowIfNull("convention");
 }
Exemple #3
0
 public void Parses_a_non_secure_url_with_port_and_without_parameters()
 {
     UrlParser parser = new UrlParser("http://localhost:8080/test/method");
     Assert.IsFalse(parser.IsHttps);
     Assert.AreEqual<int>(8080, parser.Port);
     Assert.AreEqual<string>("localhost", parser.Hostname);
     Assert.AreEqual<string>("test", parser.BusinessClass);
     Assert.AreEqual<string>("method", parser.BusinessAction);
     Assert.AreEqual<int>(0, parser.Parameters.Count);
 }
Exemple #4
0
 public void Parses_a_secure_url_with_parameters()
 {
     UrlParser parser = new UrlParser("https://localhost/test/method?id=2&name=mert");
     Assert.IsTrue(parser.IsHttps);
     Assert.AreEqual<int>(80, parser.Port);
     Assert.AreEqual<string>("localhost", parser.Hostname);
     Assert.AreEqual<string>("test", parser.BusinessClass);
     Assert.AreEqual<string>("method", parser.BusinessAction);
     Assert.AreEqual<int>(2, parser.Parameters.Count);
     Assert.AreEqual<string>("id", parser.Parameters.Keys.First());
     Assert.AreEqual<string>("2", parser.Parameters.Values.First());
     Assert.AreEqual<string>("name", parser.Parameters.Keys.Last());
     Assert.AreEqual<string>("mert", parser.Parameters.Values.Last());
 }
 public CrowBusinessController(object businessInstance, UrlParser url, INamingConvention convention)
     : base(businessInstance, url, convention)
 {
 }