コード例 #1
0
ファイル: SettingsManager.cs プロジェクト: jeason0813/NBi
        public void SetValue(string name, string value)
        {
            switch (name)
            {
            case DefaultSutName:
                settings.GetDefault(SettingsXml.DefaultScope.SystemUnderTest).ConnectionString.Inline = value;
                return;

            case DefaultAssertName:
                settings.GetDefault(SettingsXml.DefaultScope.Assert).ConnectionString.Inline = value;
                return;

            case DefaultSetupCleanupName:
                settings.GetDefault(SettingsXml.DefaultScope.Decoration).ConnectionString.Inline = value;
                return;

            case DefaultEverywhereName:
                settings.GetDefault(SettingsXml.DefaultScope.Everywhere).ConnectionString.Inline = value;
                return;
            }

            if (!name.StartsWith("Reference"))
            {
                throw new ArgumentException();
            }

            var refName   = name.Split(new[] { '-' })[1].Trim();
            var reference = settings.References.SingleOrDefault(r => r.Name == refName);

            if (reference == null)
            {
                throw new ArgumentException();
            }

            reference.ConnectionString.Inline = value;
        }