示例#1
0
 public void SignatureGeneration()
 {
     var ajaxHub = GetHub();
     var scanner = new SignatureScannerBase();
     var signatures = scanner.Scan(typeof (TestClassEndingController)).Concat(scanner.Scan(typeof(TestClassWithControllerAttribute)));
     var result = ajaxHub.RenderHubFunctions(signatures);
     Assert.That(result.Length, Is.GreaterThan(0));
 }
示例#2
0
        public void JavascriptArgumentDelegation()
        {
            var scanner = new SignatureScannerBase();
            var signatures = scanner.Scan(typeof (TestClassEndingController)).Concat(scanner.Scan(typeof(TestClassWithControllerAttribute)));

            Assert.That(signatures.Count(), Is.GreaterThan(0));
            var signatureWithArguments = signatures.FirstOrDefault(d => d.MethodArgumentNames.Length > 0);
            var argumentList = AjaxHubUtility.GetJavascriptParameterCallList(signatureWithArguments);

            Assert.That(argumentList, Is.Not.Null);
            Assert.That(argumentList.Length, Is.GreaterThan(0));
        }
示例#3
0
        public void JavascriptSignatureValuesPrefixed()
        {
            var hub = new AjaxHubProxy();

            var scanner = new SignatureScannerBase();
            var signatures = scanner.Scan(typeof (RouteTemplateWithPrefixController)).ToList();

            Assert.That(signatures.Count, Is.GreaterThanOrEqualTo(1));
            var dictionary = hub.ConvertSignatureToDictionary(signatures[0]);
            Assert.That(dictionary, Is.Not.Null);
            Assert.That(dictionary.Count, Is.GreaterThanOrEqualTo(1));

            Assert.That(dictionary["routeTemplate"], Is.EqualTo("SomePrefix/TestMethodB/{a}"));
            Assert.That(dictionary["routeName"], Is.EqualTo("TestMethodB"));
        }
示例#4
0
        public void JavascriptSignatureNoRoute()
        {
            var hub = new AjaxHubProxy();

            var scanner = new SignatureScannerBase();
            var signatures = scanner.Scan(typeof (NoRouteController)).ToList();

            Assert.That(signatures.Count, Is.GreaterThanOrEqualTo(1));
            var dictionary = hub.ConvertSignatureToDictionary(signatures[0]);
            Assert.That(dictionary, Is.Not.Null);
            Assert.That(dictionary.Count, Is.GreaterThanOrEqualTo(1));

            Assert.That(dictionary["routeTemplate"], Is.EqualTo(null));
            Assert.That(dictionary["routeName"], Is.EqualTo(null));
        }