You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -377,7 +377,7 @@ namespace System.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overriden from SettingsBase to support validation event.
|
||||
/// Overridden from SettingsBase to support validation event.
|
||||
/// </summary>
|
||||
public override void Save()
|
||||
{
|
||||
@@ -391,7 +391,7 @@ namespace System.Configuration
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overriden from SettingsBase to support validation event.
|
||||
/// Overridden from SettingsBase to support validation event.
|
||||
/// </summary>
|
||||
public override object this[string propertyName]
|
||||
{
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace System.Configuration
|
||||
// (1) Company name
|
||||
string part1 = Validate(_companyName, limitSize: true);
|
||||
|
||||
// (2) Domain or product name & a application urit hash
|
||||
// (2) Domain or product name & an application urit hash
|
||||
string namePrefix = Validate(AppDomain.CurrentDomain.FriendlyName, limitSize: true);
|
||||
if (string.IsNullOrEmpty(namePrefix))
|
||||
namePrefix = Validate(ProductName, limitSize: true);
|
||||
|
||||
@@ -1336,7 +1336,7 @@ namespace System.Configuration
|
||||
((lockType != ConfigurationLockCollectionType.LockedElements) &&
|
||||
(lockType != ConfigurationLockCollectionType.LockedElementsExceptionList) &&
|
||||
typeof(ConfigurationElement).IsAssignableFrom(propToLock.Type)) ||
|
||||
// or if not locking elements but the property is a element
|
||||
// or if not locking elements but the property is an element
|
||||
(((lockType == ConfigurationLockCollectionType.LockedElements) ||
|
||||
(lockType == ConfigurationLockCollectionType.LockedElementsExceptionList)) &&
|
||||
!typeof(ConfigurationElement).IsAssignableFrom(propToLock.Type))
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace System.Configuration
|
||||
Any access via indexes have to go through some transformation step.
|
||||
|
||||
The Alternate version changes the inheritance stuff like the BasicMapAlternate,
|
||||
where the "nearest" config file entries take precendence over the "parent"
|
||||
where the "nearest" config file entries take precedence over the "parent"
|
||||
config file entries (see example above).
|
||||
**********************************************************************/
|
||||
|
||||
@@ -55,4 +55,4 @@ namespace System.Configuration
|
||||
BasicMapAlternate,
|
||||
AddRemoveClearMapAlternate,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace System.Configuration
|
||||
}
|
||||
|
||||
// the connection string behavior is strange in that is acts kind of like a
|
||||
// basic map and partially like a add remove clear collection
|
||||
// basic map and partially like an add remove clear collection
|
||||
// Overriding these methods allows for the specific behaviors to be
|
||||
// patterened
|
||||
protected override void BaseAdd(int index, ConfigurationElement element)
|
||||
@@ -83,4 +83,4 @@ namespace System.Configuration
|
||||
BaseClear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
e0f4661dc2c2be051b341c569966baea84d7789b
|
||||
87057bfb1dc6c7c795d76ec1d27d11238bbaec0b
|
||||
@@ -13,7 +13,7 @@ namespace System.Configuration
|
||||
// result can be null, so we use this object to indicate whether it has been evaluated
|
||||
private static readonly object s_unevaluated = new object();
|
||||
|
||||
// accummulated errors related to this input
|
||||
// accumulated errors related to this input
|
||||
private readonly List<ConfigurationException> _errors;
|
||||
|
||||
// Provider to use for encryption
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace System.Configuration
|
||||
// * Method to copy a configuration section to a string.
|
||||
// * Methods to format a string of XML.
|
||||
//
|
||||
// Errors found during read are accumlated in a ConfigurationSchemaErrors object.
|
||||
// Errors found during read are accumulated in a ConfigurationSchemaErrors object.
|
||||
internal sealed class XmlUtil : IDisposable, IConfigErrorInfo
|
||||
{
|
||||
private const int MaxLineWidth = 60;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections;
|
||||
using Xunit;
|
||||
@@ -37,7 +38,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
public class ConfigurationLockCollectionTest
|
||||
{
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void InitialState()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -73,7 +74,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal(col, col.SyncRoot);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void NonExistentItem()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -84,7 +85,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Throws<ConfigurationErrorsException>(() => col.IsReadOnly("file"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void Populate()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -98,7 +99,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.True(col.Contains("file"), "A4");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void Populate_Error()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -107,7 +108,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Throws<ConfigurationErrorsException>(() => col.Add("boo"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void Enumerator()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -121,7 +122,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.False(e.MoveNext(), "A3");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void SetFromList()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -139,7 +140,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.True(col.Contains("file"), "A2");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
[ActiveIssue("dotnet/corefx #18195", TargetFrameworkMonikers.NetFramework)]
|
||||
public void DuplicateAdd()
|
||||
{
|
||||
@@ -154,7 +155,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal(1, app.LockAttributes.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void IsReadOnly()
|
||||
{
|
||||
SysConfig cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace MonoTests.System.Configuration
|
||||
|
||||
public class ConfigurationManagerTest
|
||||
{
|
||||
[Fact] // OpenExeConfiguration (ConfigurationUserLevel)
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] // OpenExeConfiguration (ConfigurationUserLevel)
|
||||
[ActiveIssue("dotnet/corefx #19384", TargetFrameworkMonikers.NetFramework)]
|
||||
public void OpenExeConfiguration1_UserLevel_None()
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal(TestUtil.ThisConfigFileName, fi.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void OpenExeConfiguration1_UserLevel_PerUserRoaming()
|
||||
{
|
||||
string applicationData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
@@ -66,7 +66,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal("user.config", fi.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
[ActiveIssue(15065, TestPlatforms.AnyUnix)]
|
||||
public void OpenExeConfiguration1_UserLevel_PerUserRoamingAndLocal()
|
||||
{
|
||||
@@ -140,24 +140,22 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal(TestUtil.ThisApplicationPath + ".config", config.FilePath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void exePath_UserLevelPerRoaming()
|
||||
{
|
||||
string applicationData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
|
||||
// If there is not ApplicationData folder PerUserRoaming won't work
|
||||
if (string.IsNullOrEmpty(applicationData)) return;
|
||||
|
||||
Assert.True(Directory.Exists(applicationData), "application data should exist");
|
||||
if (string.IsNullOrEmpty(applicationData))
|
||||
return;
|
||||
|
||||
SysConfig config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);
|
||||
string filePath = config.FilePath;
|
||||
Assert.False(string.IsNullOrEmpty(filePath), "should have some file path");
|
||||
Assert.True(filePath.StartsWith(applicationData), "#1:" + filePath);
|
||||
Assert.Equal("user.config", Path.GetFileName(filePath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
[ActiveIssue(15066, TestPlatforms.AnyUnix)]
|
||||
public void exePath_UserLevelPerRoamingAndLocal()
|
||||
{
|
||||
@@ -260,7 +258,7 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal("machineconfig", fi.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
// Doesn't pass on Mono
|
||||
// [Category("NotWorking")]
|
||||
[ActiveIssue("dotnet/corefx #19384", TargetFrameworkMonikers.NetFramework)]
|
||||
@@ -283,13 +281,13 @@ namespace MonoTests.System.Configuration
|
||||
Assert.Equal("machine.config", fi.Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void GetSectionReturnsNativeObject()
|
||||
{
|
||||
Assert.True(ConfigurationManager.GetSection("appSettings") is NameValueCollection);
|
||||
}
|
||||
|
||||
[Fact] // Test for bug #3412
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))] // Test for bug #3412
|
||||
// Doesn't pass on Mono
|
||||
// [Category("NotWorking")]
|
||||
public void TestAddRemoveSection()
|
||||
@@ -345,7 +343,7 @@ namespace MonoTests.System.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void TestContext()
|
||||
{
|
||||
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
|
||||
<Link>Common\System\PlatformDetection.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonTestPath)\System\IO\TempDirectory.cs">
|
||||
<Link>Common\System\IO\TempDirectory.cs</Link>
|
||||
</Compile>
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace System.ConfigurationTests
|
||||
}
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(true)
|
||||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)),
|
||||
InlineData(true),
|
||||
InlineData(false)
|
||||
]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
@@ -56,8 +56,8 @@ namespace System.ConfigurationTests
|
||||
Assert.NotNull(settings.Context);
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(true)
|
||||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)),
|
||||
InlineData(true),
|
||||
InlineData(false)
|
||||
]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
@@ -71,8 +71,8 @@ namespace System.ConfigurationTests
|
||||
Assert.NotNull(settings.Providers[typeof(LocalFileSettingsProvider).Name]);
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(true)
|
||||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)),
|
||||
InlineData(true),
|
||||
InlineData(false)
|
||||
]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
@@ -87,8 +87,8 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal("Foo", settings.StringProperty);
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(true)
|
||||
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp)),
|
||||
InlineData(true),
|
||||
InlineData(false)
|
||||
]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
@@ -103,7 +103,7 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(10, settings.IntProperty);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
public void Reload_SimpleSettings_Ok()
|
||||
{
|
||||
@@ -140,7 +140,7 @@ namespace System.ConfigurationTests
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
[ActiveIssue("dotnet/corefx #18832", TargetFrameworkMonikers.NetFramework)]
|
||||
public void SettingsProperty_SettingsWithAttributes_Ok()
|
||||
{
|
||||
|
||||
@@ -9,25 +9,25 @@ namespace System.ConfigurationTests
|
||||
{
|
||||
public class ConfigPathUtilityTests
|
||||
{
|
||||
[Theory
|
||||
InlineData(null, false)
|
||||
InlineData(@"", false)
|
||||
InlineData(@"\", false)
|
||||
InlineData(@"/", false)
|
||||
InlineData(@".", false)
|
||||
InlineData(@"..", false)
|
||||
InlineData(@"a", true)
|
||||
InlineData(@"a\", false)
|
||||
InlineData(@"\a", false)
|
||||
InlineData(@"/a", false)
|
||||
InlineData(@"a/", false)
|
||||
InlineData(@"a/b", true)
|
||||
InlineData(@"a//c", false)
|
||||
InlineData(@"a\b", false)
|
||||
InlineData(@"a/b/c", true)
|
||||
InlineData(@"a/b./c", true)
|
||||
InlineData(@"a/b../c", true)
|
||||
InlineData(@"a/../c", false)
|
||||
[Theory,
|
||||
InlineData(null, false),
|
||||
InlineData(@"", false),
|
||||
InlineData(@"\", false),
|
||||
InlineData(@"/", false),
|
||||
InlineData(@".", false),
|
||||
InlineData(@"..", false),
|
||||
InlineData(@"a", true),
|
||||
InlineData(@"a\", false),
|
||||
InlineData(@"\a", false),
|
||||
InlineData(@"/a", false),
|
||||
InlineData(@"a/", false),
|
||||
InlineData(@"a/b", true),
|
||||
InlineData(@"a//c", false),
|
||||
InlineData(@"a\b", false),
|
||||
InlineData(@"a/b/c", true),
|
||||
InlineData(@"a/b./c", true),
|
||||
InlineData(@"a/b../c", true),
|
||||
InlineData(@"a/../c", false),
|
||||
InlineData(@"a/./c", false)
|
||||
]
|
||||
public void IsValid(string configPath, bool expected)
|
||||
@@ -35,7 +35,7 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, ConfigPathUtility.IsValid(configPath));
|
||||
}
|
||||
|
||||
[Theory
|
||||
[Theory,
|
||||
InlineData(@"a", @"b", @"a/b")
|
||||
]
|
||||
public void Combine(string parentConfigPath, string childConfigPath, string expected)
|
||||
@@ -43,8 +43,8 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, ConfigPathUtility.Combine(parentConfigPath, childConfigPath));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(@"a", new string[] { "a" })
|
||||
[Theory,
|
||||
InlineData(@"a", new string[] { "a" }),
|
||||
InlineData(@"a/b", new string[] { "a", "b" })
|
||||
]
|
||||
public void GetParts(string configPath, string[] expected)
|
||||
@@ -52,10 +52,10 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, ConfigPathUtility.GetParts(configPath));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(@"a", @"a")
|
||||
InlineData(@"ab", @"ab")
|
||||
InlineData(@"a/b", @"b")
|
||||
[Theory,
|
||||
InlineData(@"a", @"a"),
|
||||
InlineData(@"ab", @"ab"),
|
||||
InlineData(@"a/b", @"b"),
|
||||
InlineData(@"a/b/c", @"c")
|
||||
]
|
||||
public void GetName(string configPath, string expected)
|
||||
|
||||
@@ -47,10 +47,9 @@ namespace System.ConfigurationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue(21004, TargetFrameworkMonikers.UapAot)]
|
||||
public void NullComparerThrows()
|
||||
{
|
||||
Assert.Equal("comparer", Assert.Throws<ArgumentNullException>(() => new SimpleCollection(null)).ParamName);
|
||||
AssertExtensions.Throws<ArgumentNullException>("comparer", () => new SimpleCollection(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -34,10 +34,10 @@ namespace System.ConfigurationTests
|
||||
AssertExtensions.Throws<ArgumentException>("name", () => new ConfigurationProperty("", typeof(string)));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData("lock")
|
||||
InlineData("locks")
|
||||
InlineData("config")
|
||||
[Theory,
|
||||
InlineData("lock"),
|
||||
InlineData("locks"),
|
||||
InlineData("config"),
|
||||
InlineData("configuration")
|
||||
]
|
||||
public void ReservedNameThrows(string name)
|
||||
@@ -45,11 +45,11 @@ namespace System.ConfigurationTests
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new ConfigurationProperty(name, typeof(string)));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData("Lock")
|
||||
InlineData("ilock")
|
||||
InlineData("LOCKS")
|
||||
InlineData("CoNfig")
|
||||
[Theory,
|
||||
InlineData("Lock"),
|
||||
InlineData("ilock"),
|
||||
InlineData("LOCKS"),
|
||||
InlineData("CoNfig"),
|
||||
InlineData("conFIGuration")
|
||||
]
|
||||
public void ReservedNameOrdinallyCompared(string name)
|
||||
@@ -164,8 +164,8 @@ namespace System.ConfigurationTests
|
||||
Assert.IsType<GenericEnumConverter>(property.Converter);
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(typeof(string), typeof(StringConverter))
|
||||
[Theory,
|
||||
InlineData(typeof(string), typeof(StringConverter)),
|
||||
InlineData(typeof(int), typeof(Int32Converter))
|
||||
]
|
||||
public void FindConverterForBuiltInTypes(Type type, Type converterType)
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace System.ConfigurationTests
|
||||
{
|
||||
public class ImplicitMachineConfigTests
|
||||
{
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void RuntimeAppSettingsAccessible()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace System.ConfigurationTests
|
||||
["SettingsKey"] = "SettingsKeyFoo"
|
||||
};
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void GetPropertyValues_NotStoredProperty_ValueEqualsNull()
|
||||
{
|
||||
var property = new SettingsProperty("PropertyName");
|
||||
@@ -30,7 +30,7 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(null, propertyValues["PropertyName"].PropertyValue);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotNetNativeRunningAsConsoleApp))]
|
||||
public void GetPropertyValues_NotStoredConnectionStringProperty_ValueEqualsEmptyString()
|
||||
{
|
||||
var property = new SettingsProperty("PropertyName");
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace System.ConfigurationTests
|
||||
{
|
||||
public class StringUtilTests
|
||||
{
|
||||
[Theory
|
||||
InlineData(null, null, true)
|
||||
InlineData(@"", null, true)
|
||||
InlineData(null, @"", true)
|
||||
InlineData(@"", @"", true)
|
||||
InlineData(@"a", null, false)
|
||||
InlineData(null, @"a", false)
|
||||
InlineData(@"a", @"", false)
|
||||
InlineData(@"", @"a", false)
|
||||
InlineData(@"A", @"a", false)
|
||||
[Theory,
|
||||
InlineData(null, null, true),
|
||||
InlineData(@"", null, true),
|
||||
InlineData(null, @"", true),
|
||||
InlineData(@"", @"", true),
|
||||
InlineData(@"a", null, false),
|
||||
InlineData(null, @"a", false),
|
||||
InlineData(@"a", @"", false),
|
||||
InlineData(@"", @"a", false),
|
||||
InlineData(@"A", @"a", false),
|
||||
InlineData(@"a", @"a", true)
|
||||
]
|
||||
public void EqualsOrBothNullOrEmpty(string s1, string s2, bool expected)
|
||||
@@ -26,16 +26,16 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, StringUtil.EqualsOrBothNullOrEmpty(s1, s2));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(null, null, true)
|
||||
InlineData(@"", null, false)
|
||||
InlineData(null, @"", false)
|
||||
InlineData(@"", @"", true)
|
||||
InlineData(@"a", null, false)
|
||||
InlineData(null, @"a", false)
|
||||
InlineData(@"a", @"", false)
|
||||
InlineData(@"", @"a", false)
|
||||
InlineData(@"A", @"a", true)
|
||||
[Theory,
|
||||
InlineData(null, null, true),
|
||||
InlineData(@"", null, false),
|
||||
InlineData(null, @"", false),
|
||||
InlineData(@"", @"", true),
|
||||
InlineData(@"a", null, false),
|
||||
InlineData(null, @"a", false),
|
||||
InlineData(@"a", @"", false),
|
||||
InlineData(@"", @"a", false),
|
||||
InlineData(@"A", @"a", true),
|
||||
InlineData(@"a", @"a", true)
|
||||
]
|
||||
public void EqualsIgnoreCase(string s1, string s2, bool expected)
|
||||
@@ -43,20 +43,20 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, StringUtil.EqualsIgnoreCase(s1, s2));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(null, null, false)
|
||||
InlineData(@"", null, false)
|
||||
InlineData(null, @"", false)
|
||||
InlineData(@"", @"", true)
|
||||
InlineData(@"a", null, false)
|
||||
InlineData(null, @"a", false)
|
||||
InlineData(@"a", @"", true)
|
||||
InlineData(@"", @"a", false)
|
||||
InlineData(@"A", @"a", false)
|
||||
InlineData(@"a", @"a", true)
|
||||
InlineData(@"a", @"abba", false)
|
||||
InlineData(@"abba", @"ab", true)
|
||||
InlineData(@"abba", @"abba", true)
|
||||
[Theory,
|
||||
InlineData(null, null, false),
|
||||
InlineData(@"", null, false),
|
||||
InlineData(null, @"", false),
|
||||
InlineData(@"", @"", true),
|
||||
InlineData(@"a", null, false),
|
||||
InlineData(null, @"a", false),
|
||||
InlineData(@"a", @"", true),
|
||||
InlineData(@"", @"a", false),
|
||||
InlineData(@"A", @"a", false),
|
||||
InlineData(@"a", @"a", true),
|
||||
InlineData(@"a", @"abba", false),
|
||||
InlineData(@"abba", @"ab", true),
|
||||
InlineData(@"abba", @"abba", true),
|
||||
InlineData(@"ABBA", @"abba", false)
|
||||
]
|
||||
public void StartsWithOrdinal(string s1, string s2, bool expected)
|
||||
@@ -64,20 +64,20 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, StringUtil.StartsWithOrdinal(s1, s2));
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(null, null, false)
|
||||
InlineData(@"", null, false)
|
||||
InlineData(null, @"", false)
|
||||
InlineData(@"", @"", true)
|
||||
InlineData(@"a", null, false)
|
||||
InlineData(null, @"a", false)
|
||||
InlineData(@"a", @"", true)
|
||||
InlineData(@"", @"a", false)
|
||||
InlineData(@"A", @"a", true)
|
||||
InlineData(@"a", @"a", true)
|
||||
InlineData(@"a", @"abba", false)
|
||||
InlineData(@"abba", @"ab", true)
|
||||
InlineData(@"abba", @"abba", true)
|
||||
[Theory,
|
||||
InlineData(null, null, false),
|
||||
InlineData(@"", null, false),
|
||||
InlineData(null, @"", false),
|
||||
InlineData(@"", @"", true),
|
||||
InlineData(@"a", null, false),
|
||||
InlineData(null, @"a", false),
|
||||
InlineData(@"a", @"", true),
|
||||
InlineData(@"", @"a", false),
|
||||
InlineData(@"A", @"a", true),
|
||||
InlineData(@"a", @"a", true),
|
||||
InlineData(@"a", @"abba", false),
|
||||
InlineData(@"abba", @"ab", true),
|
||||
InlineData(@"abba", @"abba", true),
|
||||
InlineData(@"ABBA", @"abba", true)
|
||||
]
|
||||
public void StartsWithOrdinalIgnoreCase(string s1, string s2, bool expected)
|
||||
@@ -85,7 +85,7 @@ namespace System.ConfigurationTests
|
||||
Assert.Equal(expected, StringUtil.StartsWithOrdinalIgnoreCase(s1, s2));
|
||||
}
|
||||
|
||||
[Theory
|
||||
[Theory,
|
||||
InlineData(new object[] { "1", "2", "3" }, new string[] { "1", "2", "3" } )
|
||||
]
|
||||
public void ObjectArrayToStringArray(object[] objectArray, string[] expected)
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace System.ConfigurationTests
|
||||
{
|
||||
public class ValidatiorUtilsTests
|
||||
{
|
||||
[Theory
|
||||
InlineData(@"a", typeof(string), false)
|
||||
InlineData(null, typeof(string), false)
|
||||
InlineData(@"a", typeof(int), true)
|
||||
InlineData(1, typeof(string), true)
|
||||
[Theory,
|
||||
InlineData(@"a", typeof(string), false),
|
||||
InlineData(null, typeof(string), false),
|
||||
InlineData(@"a", typeof(int), true),
|
||||
InlineData(1, typeof(string), true),
|
||||
]
|
||||
public void HelperParamValidation(object value, Type allowedType, bool shouldThrow)
|
||||
{
|
||||
@@ -28,22 +28,22 @@ namespace System.ConfigurationTests
|
||||
}
|
||||
}
|
||||
|
||||
[Theory
|
||||
[Theory,
|
||||
// Exclusive in range
|
||||
InlineData(1, 1, 1, 1, true, true, "Validation_scalar_range_violation_not_different")
|
||||
InlineData(1, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range")
|
||||
InlineData(2, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range")
|
||||
InlineData(1, 1, 1, 1, true, true, "Validation_scalar_range_violation_not_different"),
|
||||
InlineData(1, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range"),
|
||||
InlineData(2, 1, 2, 1, true, true, "Validation_scalar_range_violation_not_outside_range"),
|
||||
// Not exclusive in range
|
||||
InlineData(1, 1, 1, 1, false, false, null)
|
||||
InlineData(1, 1, 2, 1, false, false, null)
|
||||
InlineData(2, 1, 2, 1, false, false, null)
|
||||
InlineData(1, 1, 1, 1, false, false, null),
|
||||
InlineData(1, 1, 2, 1, false, false, null),
|
||||
InlineData(2, 1, 2, 1, false, false, null),
|
||||
// Exclusive out of range
|
||||
InlineData(2, 1, 1, 1, true, false, null)
|
||||
InlineData(3, 1, 2, 1, true, false, null)
|
||||
InlineData(3, 1, 2, 1, true, false, null)
|
||||
InlineData(2, 1, 1, 1, true, false, null),
|
||||
InlineData(3, 1, 2, 1, true, false, null),
|
||||
InlineData(3, 1, 2, 1, true, false, null),
|
||||
// Not exclusive out of range
|
||||
InlineData(2, 1, 1, 1, false, true, "Validation_scalar_range_violation_not_equal")
|
||||
InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range")
|
||||
InlineData(2, 1, 1, 1, false, true, "Validation_scalar_range_violation_not_equal"),
|
||||
InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range"),
|
||||
InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range")
|
||||
]
|
||||
public void ValidateIntScalar(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message)
|
||||
@@ -61,8 +61,8 @@ namespace System.ConfigurationTests
|
||||
}
|
||||
}
|
||||
|
||||
[Theory
|
||||
InlineData(1, 1, 1, 1, false, false, null)
|
||||
[Theory,
|
||||
InlineData(1, 1, 1, 1, false, false, null),
|
||||
InlineData(1, 1, 1, 2, false, true, "Validator_scalar_resolution_violation")
|
||||
]
|
||||
public void ValidateIntBadResolution(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message)
|
||||
|
||||
Reference in New Issue
Block a user