コード例 #1
0
ファイル: Website.cs プロジェクト: sybrix/EdFi-App
        public static void InitializeLinkGenerators(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
        {
            var properties = typeof(Website).GetProperties(BindingFlags.Static | BindingFlags.Public);

            var linkProperties =
                from p in properties
                where typeof(SiteAreaBase).IsAssignableFrom(p.PropertyType)
                select p;

            foreach (var linkProperty in linkProperties)
            {
                // Find available constructors for target property
                var constructor =
                    (from c in linkProperty.PropertyType.GetConstructors()
                     orderby c.GetParameters().Length
                     select new { Method = c, ParameterCount = c.GetParameters().Length })
                     .First();

                // Invoke shortest constructor with null values
                var instance = constructor.Method.Invoke(new object[constructor.ParameterCount]) as SiteAreaBase;

                instance.RouteValuesPreparer = routeValuesPreparer;
                instance.HttpRequestProvider = httpRequestProviderFake;

                linkProperty.SetValue(null, instance, null);
            }
        }
コード例 #2
0
ファイル: StaffRouteFixtures.cs プロジェクト: sybrix/EdFi-App
 protected virtual void InitializeStaffLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     Staff = new Staff(fakeClassroomViewProvider, new StubCodeIdProvider(), new StubLocalEducationAgencyContextProvider(), null)
         {
             RouteValuesPreparer = routeValuesPreparer,
             HttpRequestProvider = httpRequestProviderFake
         };
 }
コード例 #3
0
 protected virtual void InitializeGeneralLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     General = new General
     {
         RouteValuesPreparer = routeValuesPreparer,
         HttpRequestProvider = httpRequestProviderFake
     };
 }
コード例 #4
0
        protected override void InitializeRouteGenerationForTesting(string baseUrl)
        {
            RouteTestingExtensions.BaseUrl = baseUrl;

            var baseUri = new Uri(baseUrl);

            // Initialize link generators
            var routeValuesPreparer = new RouteValuesPreparer(new UITestRouteValueProvider().ToArray());
            var httpRequestProviderFake = new HttpRequestProviderFake(baseUri.Scheme, baseUri.Host, baseUri.LocalPath);

            Website.InitializeLinkGenerators(routeValuesPreparer, httpRequestProviderFake);
            //InitializeLinkGenerators(routeValuesPreparer, httpRequestProviderFake);
        }
コード例 #5
0
 protected virtual void InitializeSearchLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     Search = new Search();
     Search.RouteValuesPreparer = routeValuesPreparer;
     Search.HttpRequestProvider = httpRequestProviderFake;
 }
コード例 #6
0
 protected virtual void InitializeSchoolLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     School = new School(null);
     School.RouteValuesPreparer = routeValuesPreparer;
     School.HttpRequestProvider = httpRequestProviderFake;
 }
コード例 #7
0
 protected virtual void InitializeLocalEducationAgencyLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     LocalEducationAgency = new LocalEducationAgency(new LocalEducationAgencyRandomImageLinkProvider(new NullImageLinkProvider()));
     LocalEducationAgency.RouteValuesPreparer = routeValuesPreparer;
     LocalEducationAgency.HttpRequestProvider = httpRequestProviderFake;
 }
コード例 #8
0
 protected virtual void InitializeApplicationLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     Application = new ApplicationLinks();
     Application.RouteValuesPreparer = routeValuesPreparer;
     Application.HttpRequestProvider = httpRequestProviderFake;
 }
コード例 #9
0
ファイル: ErrorRouteFixtures.cs プロジェクト: sybrix/EdFi-App
 protected virtual void InitializeErrorLinkGenerator(RouteValuesPreparer routeValuesPreparer, HttpRequestProviderFake httpRequestProviderFake)
 {
     Error = new Error();
     Error.RouteValuesPreparer = routeValuesPreparer;
     Error.HttpRequestProvider = httpRequestProviderFake;
 }
コード例 #10
0
 protected override void ExecuteTest()
 {
     var preparer = new RouteValuesPreparer(new[] { firstValueProviderMock.Object, secondValueProviderMock.Object });
     preparer.PrepareRouteValues("TestRoute", suppliedRouteValues);
 }
コード例 #11
0
 protected override void ExecuteTest()
 {
     var preparer = new RouteValuesPreparer(new[] { leaValueProviderMock.Object, schoolValueProviderMock.Object, metricProviderMock.Object });
     preparer.PrepareRouteValues("TestRoute", suppliedRouteValues);
 }