コード例 #1
0
 public void SetUp()
 {
     _routeCollection = MockRepository.GenerateMock<IRouteCollection>();
     _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
     _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path");
     _urlResolver = new UrlResolver(_routeCollection, _httpRuntime);
 }
コード例 #2
0
            public async void Must_ignore_restriction_mapper_types_specified_in_ignorerestrictionmappertypeattribute()
            {
                _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/");

                var request = MockRepository.GenerateMock <HttpRequestBase>();

                request.Stub(arg => arg.Url).Return(new Uri("http://localhost"));

                MatchResult matchResult = await _routes[0].MatchesRequestAsync(request);

                Assert.That(matchResult.ResultType, Is.EqualTo(MatchResultType.RouteMatched));
            }
コード例 #3
0
 public void SetUp()
 {
     _routeCollection = new RouteCollection
         {
             new Route.Routing.Route("name", Guid.NewGuid(), "relative")
         };
     _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
     _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path");
     _urlResolver = new UrlResolver(_routeCollection, _httpRuntime);
 }
コード例 #4
0
 public void SetUp()
 {
     _id = Guid.Parse("265e2da0-458d-40c1-850c-b8ceb1d798a4");
     _routeCollection = new RouteCollection
         {
             new Route.Routing.Route("name", _id, "relative")
         };
     _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
     _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/path");
     _urlResolver = new UrlResolver(_routeCollection, _httpRuntime);
 }
コード例 #5
0
            public void Must_prefix_url_with_only_one_slash(string appDomainAppVirtualPath)
            {
                _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return(appDomainAppVirtualPath);

                Assert.That(_urlResolver.Absolute("relative"), Is.EqualTo("/relative"));
            }
コード例 #6
0
 public void SetUp()
 {
     _httpRuntime = MockRepository.GenerateMock<IHttpRuntime>();
     _httpRuntime.Stub(arg => arg.AppDomainAppVirtualPath).Return("/virtual");
     _restriction = new UrlRelativePathRestriction("relative", CaseInsensitivePlainComparer.Instance, _httpRuntime);
     _request = MockRepository.GenerateMock<HttpRequestBase>();
     _request.Stub(arg => arg.Url).Return(new Uri("http://localhost/virtual/r"));
 }