public void GetEnumConvertsToEnum(
            DefaultSettingConverter converter)
        {
            var converted = converter.Convert <TestEnum>("None");

            Assert.Equal(TestEnum.None, converted);
        }
 public void GetInvalidIntThrowsFormatException(
     DefaultSettingConverter converter,
     string settingValue)
 {
     Assert.Throws <FormatException>(
         () => converter.Convert <int>(settingValue));
 }
        public void GetNullValueReturnsNull(
            DefaultSettingConverter converter)
        {
            var converted = converter.Convert <string>(null);

            Assert.Null(converted);
        }
        public void GetValidIntReturnsInt(
            DefaultSettingConverter converter,
            int settingValue)
        {
            var converted = converter.Convert <int>(settingValue.ToString());

            Assert.Equal(settingValue, converted);
        }
        public void GetStringReturnsString(
            DefaultSettingConverter converter,
            string settingValue)
        {
            var converted = converter.Convert <string>(settingValue);

            Assert.Equal(settingValue, converted);
        }
        public void GetSeparatedStringAsCollectionConvertsToCollection(
            DefaultSettingConverter converter,
            string settingValue)
        {
            var converted = converter.Convert <IEnumerable <string> >("foo|bar");

            Assert.Equal(new List <string> {
                "foo", "bar"
            }, converted);
        }
        public void GetSingleStringAsCollectionConvertsToCollection(
            DefaultSettingConverter converter,
            string settingValue)
        {
            var converted = converter.Convert <IEnumerable <string> >(settingValue);

            Assert.Equal(new List <string> {
                settingValue
            }, converted);
        }
        public void GetSeparatedStringAsIntCollectionConvertsToCollection(
            DefaultSettingConverter converter,
            string settingValue)
        {
            var converted = converter.Convert <IEnumerable <int> >("1|2|3");

            Assert.Equal(new List <int> {
                1, 2, 3
            }, converted);
        }
 public void GetInvalidEnumThrowsArgumentException(
     DefaultSettingConverter converter)
 {
     Assert.Throws <ArgumentException>(
         () => converter.Convert <TestEnum>("Foo"));
 }