コード例 #1
0
		public static void VerifyRouting(Action<RouteCollection> registerRoutesMethod, params string[] urls)
		{
			var routes = new RouteCollection();
			registerRoutesMethod(routes);
			var sb = new StringBuilder();
			foreach (var url in urls)
			{
				var correctedUrl = url.StartsWith("~") ? url : '~' + url;
				HttpContextBase httpContext = new MockContextBase(correctedUrl);
				var route = routes.GetRouteData(httpContext);
				sb.AppendFormat("{0} => {1} \r\n", url, route.Values.ToReadableString());
			}
			ApprovalTests.Approvals.Verify(sb.ToString());
		}
コード例 #2
0
        public static void VerifyRouting(Action <RouteCollection> registerRoutesMethod, params string[] urls)
        {
            var routes = new RouteCollection();

            registerRoutesMethod(routes);
            var sb = new StringBuilder();

            foreach (var url in urls)
            {
                var             correctedUrl = url.StartsWith("~") ? url : '~' + url;
                HttpContextBase httpContext  = new MockContextBase(correctedUrl);
                var             route        = routes.GetRouteData(httpContext);
                sb.AppendFormat("{0} => {1} \r\n", url, route.Values.ToReadableString());
            }
            Approvals.Verify(sb.ToString());
        }