public void EmptyStringInput() { FontConverter converter = new FontConverter(); Font font = (Font)converter.ConvertFrom(string.Empty); Assert.Null(font); }
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); }
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); }
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(); }
public void InvalidInputThrowsInvalidEnumArgumentException(string input, string paramName) { FontConverter converter = new FontConverter(); Assert.Throws <InvalidEnumArgumentException>(paramName, () => converter.ConvertFrom(input)); }
public void InvalidInputThrowsArgumentException(string input, string paramName, string netfxParamName) { FontConverter converter = new FontConverter(); AssertExtensions.Throws <ArgumentException>(paramName, netfxParamName, () => converter.ConvertFrom(input)); }