예제 #1
0
        public void EncodingSettingDefinition_ConvertFromString_ReturnsEncoding()
        {
            var definition = new EncodingSettingDefinition("test", "desc", Encoding.Default);

            var encoding  = Encoding.UTF32;
            var converted = definition.ConvertFromString(encoding.HeaderName);

            Assert.Equal(encoding, converted);
        }
예제 #2
0
        public void EncodingSettingDefinition_ConvertToString_ReturnsHeaderName()
        {
            var definition = new EncodingSettingDefinition("test", "desc", Encoding.Default);

            var encoding = Encoding.UTF32;
            var str      = definition.ConvertToString(encoding);

            Assert.Equal(encoding.HeaderName, str);
        }
예제 #3
0
        public void EncodingSettingDefinition_Constructor_PopulatesProperties()
        {
            var definition = new EncodingSettingDefinition("test", "desc", Encoding.UTF32, SettingScopeEnum.Application);

            Assert.Equal("test", definition.Name);
            Assert.Equal("desc", definition.Description);
            Assert.Equal(Encoding.UTF32.HeaderName, definition.DefaultValue);
            Assert.Equal(SettingScopeEnum.Application, definition.Scope);
        }
예제 #4
0
        public void EncodingSettingDefinition_GetValues_ReturnsPossibleValues()
        {
            var definition = new EncodingSettingDefinition("test", "desc", Encoding.Default);
            var values     = definition.GetValues();

            Assert.NotNull(values);
            Assert.NotEmpty(values);
            foreach (var name in values)
            {
                Assert.NotNull(Encoding.GetEncoding(name));
            }
        }