コード例 #1
0
 public void ConvertTo_NotSupported(Type type)
 {
     var conv = new ColorConverter();
     var col = Color.Red;
     Assert.Throws<NotSupportedException>(() =>
     {
         conv.ConvertTo(null, CultureInfo.InvariantCulture, col, type);
     });
 }
コード例 #2
0
 public void ConvertTo_Named(string name)
 {
     var conv = new ColorConverter();
     Assert.Equal(name,
         (string) conv.ConvertTo(null, CultureInfo.InvariantCulture, Color.FromName(name), typeof(string)));
 }
コード例 #3
0
 public void ConvertTo_Empty()
 {
     var conv = new ColorConverter();
     Assert.Equal(string.Empty,
         (string) conv.ConvertTo(null, CultureInfo.InvariantCulture, Color.Empty, typeof(string)));
 }
コード例 #4
0
 public void ConvertTo(int a, int r, int g, int b)
 {
     var conv = new ColorConverter();
     Assert.Equal($"{a}, {r}, {g}, {b}",
         (string) conv.ConvertTo(null, CultureInfo.InvariantCulture, Color.FromArgb(a, r, g, b), typeof(string)));
 }