protected void Application_Start()
        {
            // This is a *partial* fix for some of the issues discovered when disabling TLS 1.0 as part of the following story: https://projects.sitkatech.com/projects/gemini/cards/4197
            // Allow multiple protocols so that we can connect to more than one endpoint, over time we may need to add Tls13 etc
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("ProjectFirma.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectPerson/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                    "~/Views/Shared/FileResourceControls/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }
		public void Constructor_CalledWithNullServiceMethodInvocation_ExpectArgumentNullExceptionWithCorrectParamName(
			RouteTableBuilder routeTableBuilder, RouteDispatchBuilder routeDispatchBuilder)
		{
			Action constructor = () => new RouteRegistrar(
				routeTableBuilder, routeDispatchBuilder, DummyServiceFactory, DummyRequestMessageBinder, null);

			constructor.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("serviceMethodInvocation");
		}
        public void Constructor_CalledWithNullServiceMethodInvocation_ExpectArgumentNullExceptionWithCorrectParamName(
            RouteTableBuilder routeTableBuilder, RouteDispatchBuilder routeDispatchBuilder)
        {
            Action constructor = () => new RouteRegistrar(
                routeTableBuilder, routeDispatchBuilder, DummyServiceFactory, DummyRequestMessageBinder, null);

            constructor.ShouldThrow <ArgumentNullException>().And.ParamName.Should().Be("serviceMethodInvocation");
        }
		public void ForService_Called_ExpectSameBuilderInstanceIsReturned()
		{
			var serviceRouteResolver = MockRepository.GenerateStub<IServiceRouteResolver>();
			serviceRouteResolver.Stub(x => x.GetServiceRoutes(Arg<Type>.Is.Anything)).Return(new Route[0]);

			var builder = new RouteTableBuilder(serviceRouteResolver);
			builder.ForService(typeof(StubService)).Should().BeSameAs(builder);
		}
Example #5
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new FirmaLogger());

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             $"ProjectFirma.Web{(!string.IsNullOrWhiteSpace(keyValuePair.Key) ? $".Areas.{keyValuePair.Key}" : string.Empty)}.Controllers",
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/ProjectLocationControls/{0}.cshtml",
                    "~/Views/Shared/ProjectGeospatialAreaControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/ProjectOrganization/{0}.cshtml",
                    "~/Views/Shared/ProjectContact/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/ProjectDocument/{0}.cshtml",
                    "~/Views/Shared/ProjectAttachment/{0}.cshtml",
                    "~/Views/Shared/UserStewardshipAreas/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "ProjectFirma"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();

            //FederatedAuthentication.ServiceConfigurationCreated += FederatedAuthentication_ServiceConfigurationCreated;
        }
Example #6
0
        protected void Application_Start()
        {
            SitkaLogger.RegisterLogger(new NeptuneLogger());
            CookiePrefixToExcludeFromEmailLogging = $"{NeptuneWebConfiguration.KeystoneOpenIDClientId}_";

            // this needs to match the Area Name declared in the Areas folder

            // create the default routes for the app and the areas
            var defaultRoutes =
                AreasDictionary.Select(
                    keyValuePair =>
                    new SitkaRouteTableEntry(string.Format("{0}_Default", keyValuePair.Key),
                                             String.Empty,
                                             string.Format("Neptune.Web{0}.Controllers", !string.IsNullOrWhiteSpace(keyValuePair.Key) ? string.Format(".Areas.{0}", keyValuePair.Key) : string.Empty),
                                             SitkaController.DefaultController,
                                             SitkaController.DefaultAction,
                                             keyValuePair.Key,
                                             keyValuePair.Value,
                                             null,
                                             false)).ToList();

            var viewLocations = new ViewEngineLocations {
                PartialViewLocations = new List <string>
                {
                    "~/Views/Shared/TextControls/{0}.cshtml",
                    "~/Views/Shared/ExpenditureAndBudgetControls/{0}.cshtml",
                    "~/Views/Shared/PerformanceMeasureControls/{0}.cshtml",
                    "~/Views/Shared/ProjectControls/{0}.cshtml",
                    "~/Views/Shared/JurisdictionControls/{0}.cshtml",
                    "~/Views/Shared/ProjectWatershedControls/{0}.cshtml",
                    "~/Views/Shared/ProjectUpdateDiffControls/{0}.cshtml",
                    "~/Views/Shared/EditAttributes/{0}.cshtml",
                    "~/Views/Shared/SortOrder/{0}.cshtml",
                    "~/Views/Shared/Location/{0}.cshtml",
                    "~/Views/Shared/UserJurisdictions/{0}.cshtml",
                    "~/Views/Shared/HRUCharacteristics/{0}.cshtml",
                    "~/Views/Shared/ModeledPerformance/{0}.cshtml",
                    "~/Views/FieldVisit/ObservationTypePreview/{0}.cshtml",
                }
            };

            // read the log4net configuration from the web.config file
            XmlConfigurator.Configure();

            Logger.InfoFormat("Application Start{0}{1} version: {2}{0}Compiled: {3:MM/dd/yyyy HH:mm:ss}{0}"
                              , Environment.NewLine
                              , "Neptune"
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.ApplicationVersion
                              , SitkaWebConfiguration.WebApplicationVersionInfo.Value.DateCompiled
                              );

            RouteTableBuilder.Build(NeptuneBaseController.AllControllerActionMethods, defaultRoutes, AreasDictionary);
            SetupCustomViewLocationsForTemplates(viewLocations, AreasDictionary);
            ModelBinders.Binders.DefaultBinder = new SitkaDefaultModelBinder();

            RegisterGlobalFilters(GlobalFilters.Filters);
            FluentValidationModelValidatorProvider.Configure();
        }
    public void RunBeforeAnyTests()
    {
        // This is a *partial* fix for some of the issues discovered when disabling TLS 1.0 as part of the following story: https://projects.sitkatech.com/projects/gemini/cards/4197
        // Allow multiple protocols so that we can connect to more than one endpoint, over time we may need to add Tls13 etc
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

        // This is necessary for tests to pass, since many will try to initialize a URL route, and we normally create the route table when the web app starts.
        // So we deliberately build the route table ahead of time.
        RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, null, Global.AreasDictionary);
    }
Example #8
0
        public void ForService_Called_ExpectSameBuilderInstanceIsReturned()
        {
            var serviceRouteResolver = MockRepository.GenerateStub <IServiceRouteResolver>();

            serviceRouteResolver.Stub(x => x.GetServiceRoutes(Arg <Type> .Is.Anything)).Return(new Route[0]);

            var builder = new RouteTableBuilder(serviceRouteResolver);

            builder.ForService(typeof(StubService)).Should().BeSameAs(builder);
        }
Example #9
0
 public void RunBeforeAnyTests()
 {
     lock (RouteTableLockObject)
     {
         if (!HasAlreadySetUpRouteTable)
         {
             // This is necessary for tests to pass, since many will try to initialize a URL route, and we normally create the route table when the web app starts.
             // So we deliberately build the route table ahead of time.
             RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, null, Global.AreasDictionary);
         }
         HasAlreadySetUpRouteTable = true;
     }
 }
Example #10
0
 public void RunBeforeAnyTests()
 {
     // This is necesary for tests to pass, since many will try to initialize a URL route, and we normally create the route table when the web app starts.
     // So we deliberately build the route table ahead of time.
     RouteTableBuilder.Build(NeptuneBaseController.AllControllerActionMethods, null, Global.AreasDictionary);
 }
Example #11
0
 public void SetupToRestoreRouteTable()
 {
     // We want to put the RouteTable back to something sensible, in case a prior test (e.g. RouteTableBuilderTest) has trashed it
     RouteTableBuilder.ClearRoutes();
     RouteTableBuilder.Build(FirmaBaseController.AllControllerActionMethods, null, Global.AreasDictionary);
 }