public void PropertiesDictionary_RoundTripIntegerSet()
        {
            var properties = new PropertiesDictionary();

            ValidateSets(properties.GetProperty(IntegerSetProperty), INTEGERSET_DEFAULT);

            var nonDefaultValue = new IntegerSet(new int[] { 3, 4 });

            properties.SetProperty(IntegerSetProperty, nonDefaultValue);

            properties = RoundTripThroughXml(properties);
            ValidateSets(properties.GetProperty(IntegerSetProperty), nonDefaultValue);

            properties = RoundTripThroughJson(properties);
            ValidateSets(properties.GetProperty(IntegerSetProperty), nonDefaultValue);
        }
Exemplo n.º 2
0
        public void PropertiesDictionary_RoundTripStringSet()
        {
            var properties = new PropertiesDictionary();

            ValidateSets(properties.GetProperty(StringSetProperty), STRINGSET_DEFAULT);

            var nonDefaultValue = new StringSet(new string[] { "d", "e" });

            properties.SetProperty(StringSetProperty, nonDefaultValue);

            properties = RoundTripThroughXml(properties);
            ValidateSets(properties.GetProperty(StringSetProperty), nonDefaultValue);

            properties = RoundTripThroughJson(properties);
            ValidateSets(properties.GetProperty(StringSetProperty), nonDefaultValue);
        }
        public void PropertiesDictionary_RoundTripBoolean()
        {
            var properties = new PropertiesDictionary();

            properties.GetProperty(BooleanProperty).Should().Be(BOOL_DEFAULT);

            bool nonDefaultValue = false;

            properties.SetProperty(BooleanProperty, nonDefaultValue);
            properties.GetProperty(BooleanProperty).Should().Be(nonDefaultValue);

            properties = RoundTripThroughXml(properties);
            properties.GetProperty(BooleanProperty).Should().Be(nonDefaultValue);

            properties = RoundTripThroughJson(properties);
            properties.GetProperty(BooleanProperty).Should().Be(nonDefaultValue);
        }
        public void PropertiesDictionary_RoundTripNestedPropertiesDictionary()
        {
            var properties = new PropertiesDictionary();

            ValidateProperties(properties.GetProperty(PropertiesDictionaryProperty), PROPERTIES_DEFAULT);

            var nonDefaultValue = new PropertiesDictionary {
                { "NewKey", 1337 }, { "AnotherKey", true }
            };

            properties.SetProperty(PropertiesDictionaryProperty, nonDefaultValue);

            properties = RoundTripThroughXml(properties);
            ValidateProperties(properties.GetProperty(PropertiesDictionaryProperty), nonDefaultValue);

            properties = RoundTripThroughJson(properties);
            ValidateProperties(properties.GetProperty(PropertiesDictionaryProperty), nonDefaultValue);
        }