Exemplo n.º 1
0
        public void EmptyStringInput()
        {
            FontConverter converter = new FontConverter();
            Font          font      = (Font)converter.ConvertFrom(string.Empty);

            Assert.Null(font);
        }
Exemplo n.º 2
0
        public void TestConvertFrom(string input, string expectedName, float expectedSize, GraphicsUnit expectedUnits, FontStyle expectedFontStyle)
        {
            FontConverter converter = new FontConverter();
            Font          font      = (Font)converter.ConvertFrom(input);

            Assert.Equal(expectedName, font.Name);
            Assert.Equal(expectedSize, font.Size);
            Assert.Equal(expectedUnits, font.Unit);
            Assert.Equal(expectedFontStyle, font.Style);
        }
Exemplo n.º 3
0
            internal void TestConvertFrom(CultureInfo culture, string input, string expectedName, float expectedSize, GraphicsUnit expectedUnits, FontStyle expectedFontStyle)
            {
                Thread.CurrentThread.CurrentCulture = culture;

                FontDescriptor font = FontConverter.ConvertFrom(input) !;

                Assert.Equal(expectedName, font.Name);
                Assert.Equal(expectedSize, font.Size);
                Assert.Equal(expectedUnits, font.Unit);
                Assert.Equal(expectedFontStyle, font.Style);
            }
Exemplo n.º 4
0
        private void ChangeFontButton_Click(object sender, EventArgs e)
        {
            var converter = new FontConverter();

            using (var fontDialog = new FontDialog
            {
                ShowHelp = true,
                MaxSize = 1,
                MinSize = 1,
                ShowColor = false,
                ShowEffects = false,
                ShowApply = false,
                Font = converter.ConvertFrom(options.Font) as Font
            })
                if (fontDialog.ShowDialog() == DialogResult.OK)
                {
                    options.Font = converter.ConvertToString(fontDialog.Font);
                }

            CollectInfo();
        }
Exemplo n.º 5
0
        public void InvalidInputThrowsInvalidEnumArgumentException(string input, string paramName)
        {
            FontConverter converter = new FontConverter();

            Assert.Throws <InvalidEnumArgumentException>(paramName, () => converter.ConvertFrom(input));
        }
Exemplo n.º 6
0
        public void InvalidInputThrowsArgumentException(string input, string paramName, string netfxParamName)
        {
            FontConverter converter = new FontConverter();

            AssertExtensions.Throws <ArgumentException>(paramName, netfxParamName, () => converter.ConvertFrom(input));
        }