Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            var logger                   = new ConsoleLogger();
            var requestMaker             = new WebRestRequestMaker();
            var settings                 = new EnvironmentVariableSettings();
            var meetSheetFactory         = new MeetsGoogleSheetFactory();
            var emailAddressSheetFactory = new EmailAddressGoogleSheetFactory();
            var dateTimeService          = new DateTimeService();

            var meetsService = new MeetsService(
                settings,
                requestMaker,
                meetSheetFactory,
                dateTimeService,
                logger);

            var emailAddressService = new EmailAddressService(
                settings,
                requestMaker,
                emailAddressSheetFactory,
                logger);

            var emailSenderService = new EmailSenderService(settings);

            services.AddSingleton <ILogger>(logger);
            services.AddSingleton <ISettings>(settings);
            services.AddSingleton <IMeetsService>(meetsService);
            services.AddSingleton <IEmailAddressService>(emailAddressService);
            services.AddSingleton <IEmailSenderService>(emailSenderService);
        }
        public void GetsCorrectEnvironmentVariable()
        {
            Environment.SetEnvironmentVariable("Test_Setting1", "TestSetting1Value");
            var environmentVariableSettings = new EnvironmentVariableSettings("Test_");

            var result = environmentVariableSettings.Get("Setting1");

            Assert.AreEqual("TestSetting1Value", result);
        }
        public void GetsAllEnvironmentVariableSettings()
        {
            Environment.SetEnvironmentVariable("Test_Setting1", "TestSetting1Value");
            Environment.SetEnvironmentVariable("Test_Setting2", "TestSetting2Value");
            var environmentVariableSettings = new EnvironmentVariableSettings("Test_");

            var result = environmentVariableSettings.GetAll();

            Assert.AreEqual("TestSetting1Value", result["Setting1"]);
            Assert.AreEqual("TestSetting2Value", result["Setting2"]);
        }
Ejemplo n.º 4
0
        public void Can_get_environment_variable()
        {
            var env  = new EnvironmentVariableSettings();
            var path = env.Get("PATH");

            Assert.That(path, Is.Not.Null);

            var unknown = env.Get("UNKNOWN");

            Assert.That(unknown, Is.Null);

            var envVars = env.GetAllKeys();

            Assert.That(envVars.Count, Is.GreaterThan(0));
        }
Ejemplo n.º 5
0
        public AppHost() : base(nameof(ServiceStackCorePresentation), typeof(FlightShoppingPresentation).Assembly)
        {
            var appSettings = new EnvironmentVariableSettings();

            ServiceStack.Licensing.RegisterLicense(appSettings.Get <string>("ServiceStackLicenseKey", string.Empty));
        }