1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
7 namespace System.Configuration.Tests
9 public class SettingElementTests
12 public void TestForInequality()
14 var ElementOne = new SettingElement("NotEqualOne", SettingsSerializeAs.String);
15 var ElementTwo = new SettingElement("NotEqualTwo", SettingsSerializeAs.String);
16 Assert.False(ElementOne.Equals(ElementTwo));
20 public void TestForEquality()
22 var ElementOne = new SettingElement("TheExactSameName", SettingsSerializeAs.String);
23 var ElementTwo = new SettingElement("TheExactSameName", SettingsSerializeAs.String);
24 Assert.True(ElementOne.Equals(ElementTwo));
28 public void DefaultSettingSerializationIsString()
30 var Element = new SettingElement();
31 Assert.Equal(SettingsSerializeAs.String, Element.SerializeAs);
35 public void DefaultNameIsEmptyString()
37 var Element = new SettingElement();
38 Assert.Equal(string.Empty, Element.Name);
42 public void DefaultValueIsNull()
44 var Element = new SettingElement();
45 Assert.Null(Element.Value.CurrentConfiguration);
49 public void DefaultConstructorEquality()
51 var ElementOne = new SettingElement();
52 var ElementTwo = new SettingElement();
53 Assert.True(ElementOne.Equals(ElementTwo));
56 [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Full framework does not have the fix for https://github.com/dotnet/corefx/issues/27875")]
58 public void DefaultConstructorEqualHashCodes()
60 var ElementOne = new SettingElement();
61 var ElementTwo = new SettingElement();
62 Assert.Equal(ElementOne.GetHashCode(), ElementTwo.GetHashCode());
66 public void NonDefaultValueHasNonNullHashCode()
68 var Element = new SettingElement("Test", SettingsSerializeAs.Xml)
70 Value = new SettingValueElement
72 ValueXml = new ConfigXmlDocument