public void GetString_Returns_Value()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());
            var value = appSettings.GetString("RealKey");

            Assert.That(value, Is.EqualTo("This is a real value"));
        }
        public void Get_Casts_To_Specified_Type()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());
            var value = appSettings.Get<int>("IntKey", 1);

            Assert.That(value, Is.EqualTo(42));
        }
		public void GetNullable_String_Returns_Null()
		{
		    var appSettings = new AppSettingsBase(new FakeAppSettings());
		    var value = appSettings.GetNullableString("NullableKey");

            Assert.That(value, Is.Null);
		}
コード例 #4
0
        public static void AddCustomAuthentication(this IServiceCollection services, AppSettingsBase appSettings)
        {
            services.AddSingleton <IAuthorizationHandler, ActiveTokenPolicy>();

            var key = Encoding.ASCII.GetBytes(appSettings.Secret);

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(JwtBearerDefaults.AuthenticationScheme, x =>
            {
                x.RequireHttpsMetadata      = false;
                x.SaveToken                 = true;
                x.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(key),
                    ValidateIssuer           = false,
                    ValidateAudience         = false,
                    ClockSkew = TimeSpan.Zero
                };
            });

            services.AddAuthorization(options =>
            {
                var defaultAuthorizationPolicyBuilder = new AuthorizationPolicyBuilder(JwtBearerDefaults.AuthenticationScheme);
                defaultAuthorizationPolicyBuilder     = defaultAuthorizationPolicyBuilder.RequireAuthenticatedUser();
                options.DefaultPolicy = defaultAuthorizationPolicyBuilder.Build();

                options.AddPolicy("ActiveToken", policy =>
                                  policy.Requirements.Add(new ActiveTokenRequirement()));
            });
        }
コード例 #5
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson();
            services.AddHttpContextAccessor();

            AppSettingsBase appSettings = new AppSettingsBase();

            Configuration.GetSection("AppSettings").Bind(appSettings);
            services.AddSingleton <AppSettingsBase>(appSettings);
            services.AddSingleton <ICommonRabbitService, CommonRabbitService>();
            services.AddSingleton <IServiceProvider>(sp => sp);
            services.AddDistributedRedisCache(options => {
                options.Configuration = appSettings.RedisAddress;
                options.InstanceName  = "";
            });
            services.AddSingleton <ITokensStore, DistributedTokensStore>();
            services.AddScoped <ISocialRepository, SocialRepository>();
            services.AddCustomAuthentication(appSettings);
            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddConsul(Configuration);
            services.AddScoped <IGetPostsStrategy, MainpagePosts>();
            services.AddScoped <IGetPostsStrategy, MyPosts>();
            services.AddScoped <IGetPostsStrategy, OtherUserPosts>();
            services.AddScoped <IGetPostsStrategy, MyNewlyAddedPost>();
            services.AddScoped <IPostsBuilder, PostsBuilder>();
        }
コード例 #6
0
        public async Task SaveAsync(AppSettingsBase settings)
        {
            //TODO throw new System.NotImplementedException();
            await Task.Delay(1000);

            return;
        }
コード例 #7
0
ファイル: AppSettingsImpl.cs プロジェクト: aceeric/mail-utils
        /// <summary>
        /// Performs custom arg validation for the utility, after invoking the base class parser.
        /// </summary>
        /// <param name="Settings">A settings instance to parse</param>
        /// <param name="CmdLineArgs">Command-line args array</param>
        /// <returns>True if args are valid, else False</returns>

        public new static bool Parse(SettingsSource Settings, string[] CmdLineArgs = null)
        {
            if (AppSettingsBase.Parse(Settings, CmdLineArgs))
            {
                if (JobID.Initialized && !((string)JobID).IsGuid())
                {
                    ParseErrorMessage = "-jobid arg must be a GUID (nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn)";
                    return(false);
                }
                if (Attachment.Initialized && !System.IO.File.Exists(Attachment))
                {
                    ParseErrorMessage = "Attachment file does not exist or is not accessible: " + Attachment;
                    return(false);
                }
                if (SSLType.Initialized && !SSLType.Value.In("auto", "onconnect"))
                {
                    ParseErrorMessage = "Unsupported value in the -ssltype arg: " + SSLType;
                    return(false);
                }
                if (LogLevel.Initialized && !LogLevel.Value.In("info", "warn", "error"))
                {
                    ParseErrorMessage = "Unsupported value in the loglevel arg: " + LogLevel;
                    return(false);
                }
                return(true);
            }
            return(false);
        }
コード例 #8
0
ファイル: Startup.cs プロジェクト: osinskim/dupa
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            services.AddControllers().AddNewtonsoftJson();
            services.AddHttpContextAccessor();

            AppSettingsBase appSettings = new AppSettingsBase();

            Configuration.GetSection("AppSettings").Bind(appSettings);
            services.AddSingleton <AppSettingsBase>(appSettings);

            services.AddScoped <IUserRepository, UserRepository>();
            services.AddScoped <IUserService, UserService>();
            services.AddScoped <IAuthenticationService, AuthenticationService>();

            services.AddDistributedRedisCache(options =>
            {
                options.Configuration = appSettings.RedisAddress;
                options.InstanceName  = "";
            });

            services.AddSingleton <ITokensStore, DistributedTokensStore>();
            services.AddCustomAuthentication(appSettings);
            services.AddOcelot().AddConsul();
        }
        public void Get_Returns_Default_Value_On_Null_Key()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());
            var value = appSettings.Get("NullableKey", "default");

            Assert.That(value, Is.EqualTo("default"));
        }
コード例 #10
0
ファイル: AppSettingsImpl.cs プロジェクト: aceeric/load-file
        /// <summary>
        /// Performs custom arg validation for the utility, after invoking the base class parser.
        /// </summary>
        /// <param name="Settings">A settings instance to parse</param>
        /// <param name="CmdLineArgs">Command-line args array</param>
        /// <returns>True if args are valid, else False</returns>

        public new static bool Parse(SettingsSource Settings, string[] CmdLineArgs = null)
        {
            if (AppSettingsBase.Parse(Settings, CmdLineArgs))
            {
                if (HeaderLine.Initialized && SkipLines.Initialized &&
                    HeaderLine.Value > SkipLines.Value)
                {
                    ParseErrorMessage = "The header line value cannot be greater than the skip lines value";
                    return(false);
                }
                if (HeaderLine.Initialized && ColFile.Initialized)
                {
                    ParseErrorMessage = "Specify either a header line value or a column file value, but not both";
                    return(false);
                }
                if (Tbl.Initialized && Tbl.Value.Contains("."))
                {
                    if (Tbl.Value.Split('.').Length != 2)
                    {
                        ParseErrorMessage = "Accepted table name forms are \"tablename\" and \"schemaname.tablename\"";
                        return(false);
                    }
                }
                if (Delimiter.Initialized)
                {
                    if (!Delimiter.Value.In("pipe", "comma", "tab", "auto"))
                    {
                        ParseErrorMessage = "Invalid value specified for the -delimiter arg";
                        return(false);
                    }
                }
                if (JobID.Initialized && !JobID.Value.IsGuid())
                {
                    ParseErrorMessage = "-jobid arg must be a GUID (nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn)";
                    return(false);
                }
                if (!Db.Initialized && !NoLoad.Value && Preview.Value <= 0)
                {
                    ParseErrorMessage = "-db argument is required unless the -noload argument is specified";
                    return(false);
                }
                if (Split.Initialized && !Prep.Initialized && Preview.Value <= 0)
                {
                    ParseErrorMessage = "Splitting requires the -prep argument, because the input file has to be split out to a prep file.";
                    return(false);
                }
                if (SQLTimeout.Initialized)
                {
                    float Timeout;
                    if (!float.TryParse(SQLTimeout.Value, out Timeout))
                    {
                        ParseErrorMessage = "Uable to parse the specified SQL timeout value as a decimal value: " + SQLTimeout.Value;
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #11
0
ファイル: AllSettings.cs プロジェクト: holycrepe/Iconify
        public static void LoadAllSettings()
        {
            var settings = (USE_ALL_SETTINGS || SAVE_ALL_SETTINGS) ? AllSettingsBase.Load() : null;

            BaseSettings.CONSTRUCTOR_ACTION = BaseSettingsConstructor.None;
            AppSettings.AppSetting          = settings?.App ?? AppSettingsBase.Load();
            LibSettings.LibSetting          = settings?.Lib ?? LibSettings.BindInstance();
        }
コード例 #12
0
        /// <summary>
        /// Performs custom arg validation for the utility, after invoking the base class parser.
        /// </summary>
        /// <param name="Settings">A settings instance to parse</param>
        /// <param name="CmdLineArgs">Command-line args array</param>
        /// <returns>True if args are valid, else False</returns>

        public new static bool Parse(SettingsSource Settings, string[] CmdLineArgs = null)
        {
            if (AppSettingsBase.Parse(Settings, CmdLineArgs))
            {
                bool YYYYMMParses = false;
                if (YYYYMM.Value.Equals("default", StringComparison.OrdinalIgnoreCase))
                {
                    int Year  = DateTime.Now.Year;
                    int Month = DateTime.Now.Month;
                    Globals.FileYYYYMM = string.Format("{0:0000}{1:00}", Year, Month);
                    YYYYMMParses       = true;
                }
                else
                {
                    int CmdLineMonth = 0;
                    if (!Regex.IsMatch(YYYYMM.Value, "^\\d{6}$"))
                    {
                        YYYYMMParses = false;
                    }
                    else if (!int.TryParse(YYYYMM.Value.Substring(4), out CmdLineMonth))
                    {
                        YYYYMMParses = false;
                    }
                    else if (!(1 <= CmdLineMonth && CmdLineMonth <= 12))
                    {
                        YYYYMMParses = false;
                    }
                    else
                    {
                        Globals.FileYYYYMM = YYYYMM.Value;
                        YYYYMMParses       = true;
                    }
                }
                if (!YYYYMMParses)
                {
                    ParseErrorMessage = string.Format("yyyymm argument value {0} must be in the form YYYYMM", YYYYMM.Value);
                    return(false);
                }
                if (!OnlyDownload && !Directory.Exists(Ingest.Value))
                {
                    ParseErrorMessage = string.Format("Ingest directory {0} does not exist", Ingest.Value);
                    return(false);
                }
                if (!OnlyDownload)
                {
                    if (!AccessKey.Initialized || !SecretKey.Initialized || !Bucket.Initialized || !Ingest.Initialized)
                    {
                        ParseErrorMessage = "S3 credentials/bucket name and ingest folder are required unless the -onlydownload option is specified";
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #13
0
        /// <summary>
        /// Provides custom parsing
        /// </summary>
        /// <param name="Src"></param>
        /// <param name="CmdLineArgs"></param>
        /// <returns></returns>

        public static new bool Parse(SettingsSource Src, string[] CmdLineArgs = null)
        {
            if (AppSettingsBase.Parse(Src, CmdLineArgs))
            {
                string s = Settings.Value;
                if (s != null && s != "file" && s != "reg")
                {
                    return(false);
                }
                return(true);
            }
            return(false);
        }
コード例 #14
0
        /// <inheritdoc />
        public MainWindow()
        {
            InitializeComponent();
            IAppSettingsBase appSettingsBase = new AppSettingsBase(Settings.Default);

            IApplicationStyle applicationStyle = new ApplicationStyle();

            applicationStyle.Load(true);

            _appSettings = new AppSettings(appSettingsBase);

            Load();
        }
コード例 #15
0
        private void btnImportEagle_Click(object sender, EventArgs e)
        {
            //
            // GenTestData.GenerateData();

            //
            AppSettings.SourceFilename = textBoxSource.Text;
            AppSettings.DestFolder     = textBoxDest.Text;
            SaveAppSettings();

            if (Directory.Exists(AppSettings.DestFolder))
            {
                bool is_empty = false;

                string[] Files = Directory.GetFiles(AppSettings.DestFolder);

                if (Files.Length == 0)
                {
                    string[] folders = Directory.GetDirectories(AppSettings.DestFolder);
                    if (folders.Length == 0)
                    {
                        is_empty = true;
                    }
                }

                if (!is_empty)
                {
                    DialogResult res = MessageBox.Show("Warning - Destination folder is not empty, files will be overwritten!" + Environment.NewLine + Environment.NewLine +
                                                       "Continue ?",
                                                       "Overwrite check",
                                                       MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation
                                                       );

                    if (res != DialogResult.Yes)
                    {
                        return;
                    }
                }
            }
            else
            {
                AppSettingsBase.CreateDirectory(AppSettings.DestFolder);
            }

            ProjectConverter converter = new ProjectConverter();
            //if (converter.CheckValid(textBoxSource.Text))
            {
                converter.OnTrace += Trace;
                converter.ConvertProject(textBoxSource.Text, textBoxDest.Text);
            }
        }
コード例 #16
0
        /// <inheritdoc />
        public MainWindow()
        {
            InitializeComponent();
            IAppSettingsBase appSettingsBase = new AppSettingsBase(Settings.Default);

            _themeManagerHelper = new ThemeManagerHelper();
            IApplicationStyle applicationStyle = new ApplicationStyle(_themeManagerHelper);

            applicationStyle.Load(true);

            _appSettings = new AppSettings(appSettingsBase);

            Load();
        }
        public void Get_Throws_Exception_On_Bad_Value()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());

            try
            {
                appSettings.Get<int>("BadIntegerKey", 1);
                Assert.Fail("Get did not throw a ConfigurationErrorsException");
            }
            catch (ConfigurationErrorsException ex)
            {
                Assert.That(ex.Message.Contains("BadIntegerKey"));
            }
        }
コード例 #18
0
        /// <inheritdoc />
        public MainWindow()
        {
            InitializeComponent();
            IAppSettingsBase appSettingsBase = new AppSettingsBase(Settings.Default);

            _roundCorners = new RoundCorners();
            IApplicationStyle style = new ApplicationStyle(_roundCorners, true);

            style.Run();
            _appSettings     = new AppSettings(appSettingsBase);
            _moveDirectory   = new MoveDirectory();
            _processByPath   = new ProcessByPath();
            _generateNewPath = new GenerateNewPath(_appSettings);
            Load();
        }
コード例 #19
0
        /// <summary>
        /// Performs custom arg validation for the utility, after invoking the base class parser.
        /// </summary>
        /// <param name="Settings">A settings instance to parse</param>
        /// <param name="CmdLineArgs">Command-line args array</param>
        /// <returns>True if args are valid, else False</returns>

        public new static bool Parse(SettingsSource Settings, string[] CmdLineArgs = null)
        {
            if (AppSettingsBase.Parse(Settings, CmdLineArgs))
            {
                if (!Type.Value.In("delimited", "fixed"))
                {
                    ParseErrorMessage = "Invalid value specified for the -type arg";
                    return(false);
                }
                if (Header.Initialized && Type.Value == "fixed" && !Header.Value.In("trunc", "fit"))
                {
                    ParseErrorMessage = "Invalid value specified for the -header arg";
                    return(false);
                }
                if (Tbl.Initialized && Tbl.Value.Contains("."))
                {
                    if (Tbl.Value.Split('.').Length != 2)
                    {
                        ParseErrorMessage = "Accepted table name forms are \"tablename\" and \"schemaname.tablename\"";
                        return(false);
                    }
                }
                if (Delimiter.Initialized)
                {
                    if (!Delimiter.Value.In("pipe", "comma", "tab"))
                    {
                        ParseErrorMessage = "Invalid value specified for the -delimiter arg";
                        return(false);
                    }
                }
                if (JobID.Initialized && !JobID.Value.IsGuid())
                {
                    ParseErrorMessage = "-jobid arg must be a GUID (nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn)";
                    return(false);
                }
                if (SQLTimeout.Initialized)
                {
                    float Timeout;
                    if (!float.TryParse(SQLTimeout.Value, out Timeout))
                    {
                        ParseErrorMessage = "Uable to parse the specified SQL timeout value as a decimal value: " + SQLTimeout.Value;
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
コード例 #20
0
        /// <summary>
        /// Parses the command line args
        /// </summary>
        /// <param name="args">from .Net</param>
        /// <returns>true if the args parsed ok, else false. If false, prints the usage instructions</returns>

        static bool ParseArgs(string[] args)
        {
            if (!AppSettingsImpl.Parse(SettingsSource.CommandLine, args))
            {
                if (AppSettingsBase.ParseErrorMessage != null)
                {
                    Console.WriteLine(AppSettingsBase.ParseErrorMessage);
                }
                else
                {
                    AppSettingsBase.ShowUsage();
                }
                return(false);
            }
            return(true);
        }
コード例 #21
0
        private static bool ConvertToKicad()
        {
            AppSettings.SourceFilename = SourceFilename;
            AppSettings.DestFolder     = DestFolder;

            if (Directory.Exists(AppSettings.DestFolder))
            {
                if (!overwrite)
                {
                    bool is_empty = false;

                    string[] Files = Directory.GetFiles(AppSettings.DestFolder);

                    if (Files.Length == 0)
                    {
                        string[] folders = Directory.GetDirectories(AppSettings.DestFolder);
                        if (folders.Length == 0)
                        {
                            is_empty = true;
                        }
                    }

                    if (!is_empty)
                    {
                        Trace("error: Destination folder is not empty, specify -overwrite option");
                        Usage();
                        return(false);
                    }
                }
            }
            else
            {
                AppSettingsBase.CreateDirectory(AppSettings.DestFolder);
            }

            ProjectConverter converter = new ProjectConverter();

            //if (converter.CheckValid(textBoxSource.Text))
            {
                converter.OnTrace += Trace;
                converter.ConvertProject(SourceFilename, DestFolder);
            }

            return(true);
        }
コード例 #22
0
        public MainWindow()
        {
            InitializeComponent();
            IAppSettingsBase          appSettingsBase          = new AppSettingsBase(Settings.Default);
            IApplicationStyleSettings applicationStyleSettings = new ApplicationStyleSettings(appSettingsBase);
            IThemeManagerHelper       themeManagerHelper       = new ThemeManagerHelper();

            _applicationStyle = new ApplicationStyle(this, Accent, ThemeSwitch, applicationStyleSettings, themeManagerHelper);
            _applicationStyle.Load(true);

            _rotateDisplay         = new RotateDisplay();
            _rotateButtonAndCanvas = new RotateButtonAndCanvas();
            Load();
            var linkerTime = Assembly.GetExecutingAssembly().GetLinkerTime();

            LinkerTime.Content = linkerTime.ToString(CultureInfo.InvariantCulture);

            Application.Current.Exit += CurrentExit;
            _overrideProtection       = 1;
            ConfigureAutoRun();
        }
コード例 #23
0
ファイル: AppSettings.cs プロジェクト: cjsatuforc/eakit
        public bool SaveToXmlFile(string FileName)
        {
            bool          result     = false;
            XmlSerializer serializer = new XmlSerializer(typeof(AppSettings));
            TextWriter    Writer     = null;

            AppSettingsBase.CreateDirectory(Path.GetDirectoryName(FileName));
            try
            {
                Writer = new StreamWriter(FileName, false, Encoding.UTF8);
                serializer.Serialize(Writer, this);
                result = true;
            }
            finally
            {
                if (Writer != null)
                {
                    Writer.Close();
                }
            }
            return(result);
        }
コード例 #24
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson();
            services.AddHttpContextAccessor();

            AppSettingsBase appSettings = new AppSettingsBase();

            Configuration.GetSection("AppSettings").Bind(appSettings);
            services.AddSingleton(appSettings);

            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddDistributedRedisCache(options => {
                options.Configuration = appSettings.RedisAddress;
                options.InstanceName  = "";
            });
            services.AddSingleton <ITokensStore, DistributedTokensStore>();

            services.AddCustomAuthentication(appSettings);

            services.AddConsul(Configuration);
            services.AddHttpClient <IConsulHttpClient, ConsulHttpClient>();
        }
コード例 #25
0
        // ReSharper restore PrivateFieldCanBeConvertedToLocalVariable

        /// <summary>
        ///     MainWindows.
        ///     Gets a new movie list instance.
        /// </summary>
        public MainWindow()
        {
            _appBasic = new AppBasic(this);

            _xmlSettings = new XmlSettings();
            _xmlDatabase = new XmlDatabase(_xmlSettings);
            _movies      = new Movies(_xmlDatabase);
            IAppSettingsBase appSettingsBase = new AppSettingsBase(Settings.Default);

            _coreSettings = new ApplicationStyleSettings(appSettingsBase);
            InitializeComponent();
            var themeManagerHelper = new ThemeManagerHelper();

            _style = new ApplicationStyle(this, Accent, ThemeSwitch, _coreSettings, themeManagerHelper);
            _style.Load(true, true);
            _dialogService = new DialogService(this);
            _addEdit       = new AddEdit(this, _movies, _dialogService);
            ValidateSettings();
            var linkerTime = Assembly.GetExecutingAssembly().GetLinkerTime();

            LinkerTime.Content = linkerTime.ToString(CultureInfo.InvariantCulture);
            _appBasic.SetComboBoxItems();
        }
コード例 #26
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson();
            services.AddHttpContextAccessor();

            AppSettingsBase appSettings = new AppSettingsBase();

            Configuration.GetSection("AppSettings").Bind(appSettings);
            services.AddSingleton <AppSettingsBase>(appSettings);

            services.AddScoped <IUserManagementRepository, UserManagementRepository>();
            services.AddTransient <IValidatorsFactory, ValidatorsFactory>();
            services.AddSingleton <ICommonRabbitService, CommonRabbitService>();

            services.AddDistributedRedisCache(options => {
                options.Configuration = appSettings.RedisAddress;
                options.InstanceName  = "";
            });
            services.AddSingleton <ITokensStore, DistributedTokensStore>();

            services.AddCustomAuthentication(appSettings);
            services.AddMediatR(Assembly.GetExecutingAssembly());
            services.AddConsul(Configuration);
        }
コード例 #27
0
ファイル: AllSettings.cs プロジェクト: holycrepe/Iconify
 static AppSettingsBase LoadAppSettings()
 => AllSettingsBase.Load()?.App ?? AppSettingsBase.Load();
コード例 #28
0
ファイル: AllSettingsBase.cs プロジェクト: holycrepe/Iconify
 public AllSettingsBase(AppSettingsBase app, LibSettings lib)
 {
     App = app;
     Lib = lib;
 }
 public void GetString_Throws_Exception_On_Nonexistent_Key()
 {
     var appSettings = new AppSettingsBase(new FakeAppSettings());
     try
     {
         appSettings.GetString("GarbageKey");
         Assert.Fail("GetString did not throw a ConfigurationErrorsException");
     }
     catch (ConfigurationErrorsException ex)
     {
         Assert.That(ex.Message.Contains("GarbageKey"));
     }
 }
コード例 #30
0
 public UserManagementRepository(AppSettingsBase appSettings)
 {
     _connectionString = appSettings.ConnectionString;
 }
コード例 #31
0
 public AuthenticationService(AppSettingsBase appSettings, IUserService userService, ITokensStore tokensStore)
 {
     _appSettings = appSettings;
     _userService = userService;
     _tokensStore = tokensStore;
 }
        public void GetList_Parses_List_From_Setting()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());
            var value = appSettings.GetList("ListKey");

            Assert.That(value, Has.Count.EqualTo(5));
            Assert.That(value, Is.EqualTo(new List<string> {"A", "B", "C", "D", "E"}));
        }
コード例 #33
0
 public void Constructor_ReturnsInterfaceName(AppSettingsBase sut)
 {
     sut.Should().BeAssignableTo <IAppSettingsBase>();
 }
コード例 #34
0
ファイル: AllSettings.cs プロジェクト: holycrepe/Iconify
 static Dictionary <string, WINDOWPLACEMENT?> LoadAppWindowPlacements()
 => AllSettingsBase.Load()?.App?.Placements ?? AppSettingsBase.Load()?.Placements;
コード例 #35
0
ファイル: SocialRepository.cs プロジェクト: osinskim/dupa
 public SocialRepository(AppSettingsBase appSettings)
 {
     _connectionString = appSettings.ConnectionString;
 }
        public void GetDictionary_Parses_Dictionary_From_Setting()
        {
            var appSettings = new AppSettingsBase(new FakeAppSettings());

            var value = appSettings.GetDictionary("DictionaryKey");

            Assert.That(value, Has.Count.EqualTo(5));
            Assert.That(value.Keys, Is.EqualTo(new List<string> { "A", "B", "C", "D", "E" }));
            Assert.That(value.Values, Is.EqualTo(new List<string> { "1", "2", "3", "4", "5" }));
        }