126 references to ConvertTo
Microsoft.AspNetCore.Http.Abstractions.Tests (1)
PathStringTests.cs (1)
295Assert.Equal("/foo", converter.ConvertTo(result, typeof(string)));
PresentationFramework (2)
System\Windows\Controls\ContentPresenter.cs (1)
1015e = (UIElement) tc.ConvertTo(content, typeof(UIElement));
System\Windows\Markup\Primitives\ElementMarkupObject.cs (1)
819value = converter.ConvertTo(expression, typeof(MarkupExtension));
System.Drawing.Common.Tests (18)
System\Drawing\FontConverterTests.cs (1)
121InstanceDescriptor descriptor = (InstanceDescriptor)converter.ConvertTo(font, typeof(InstanceDescriptor));
System\Drawing\IconConverterTests.cs (6)
136Assert.Equal(_iconStr, (string)_icoConv.ConvertTo(_icon, typeof(string))); 141newIconBytes = (byte[])_icoConv.ConvertTo(_icon, _iconBytes.GetType()); 153Assert.Equal(_iconStr, (string)_icoConvFrmTD.ConvertTo(_icon, typeof(string))); 158newIconBytes = (byte[])_icoConvFrmTD.ConvertTo(_icon, _iconBytes.GetType()); 171Assert.Equal("(none)", (string)_icoConv.ConvertTo(null, typeof(string))); 174Assert.Equal("(none)", (string)_icoConvFrmTD.ConvertTo(null, typeof(string)));
System\Drawing\ImageConverterTests.cs (6)
158Assert.Equal(_imageStr, (string)_imgConv.ConvertTo(_image, typeof(string))); 160Assert.Equal(_imageStr, (string)_imgConvFrmTD.ConvertTo(_image, typeof(string))); 164Assert.Equal("(none)", (string)_imgConv.ConvertTo(null, typeof(string))); 167Assert.Equal("(none)", (string)_imgConvFrmTD.ConvertTo(null, typeof(string))); 181newImageBytes = (byte[])_imgConvFrmTD.ConvertTo(_image, _imageBytes.GetType()); 190byte[] converted = (byte[])converter.ConvertTo(value, typeof(byte[]));
System\Drawing\ImageFormatConverterTests.cs (4)
131Assert.Equal(_imageFmtStr, (string)_imgFmtConv.ConvertTo(_imageFmt, typeof(string))); 134Assert.Equal(_imageFmtStr, (string)_imgFmtConvFrmTD.ConvertTo(_imageFmt, typeof(string))); 136Assert.Equal(string.Empty, (string)_imgFmtConv.ConvertTo(null, typeof(string))); 139Assert.Equal(string.Empty, (string)_imgFmtConvFrmTD.ConvertTo(null, typeof(string)));
System\Drawing\Printing\MarginsConverterTests.cs (1)
143Assert.Equal(string.Empty, (string)mc.ConvertTo(null, typeof(string)));
System.Windows.Controls.Ribbon (1)
Microsoft\Windows\Controls\Ribbon\RibbonHelper.cs (1)
1582DynamicResourceExtension dynamicResource = _rreConverter.ConvertTo(expr, typeof(MarkupExtension)) as DynamicResourceExtension;
System.Windows.Forms (5)
System\Resources\ResXDataNode.cs (1)
269byte[]? data = (byte[]?)converter.ConvertTo(value, typeof(byte[]));
System\Windows\Forms\ComponentModel\COM2Interop\Com2PropertyDescriptor.Com2PropDescMainConverter.cs (1)
43? baseConverter.ConvertTo(value, destinationType)
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
1484value = valueConverter.ConvertTo(value, columnType);
System\Windows\Forms\DataBinding\Binding.cs (2)
724return typeConverter.ConvertTo(value, type); 798return typeConverter.ConvertTo(value, type);
System.Windows.Forms.Design (3)
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (2)
1891if (converter.ConvertTo(value, typeof(InstanceDescriptor)) is InstanceDescriptor descriptor && descriptor.MemberInfo is not null) 1903if (converter.ConvertTo(value, typeof(InstanceDescriptor)) is InstanceDescriptor descriptor && descriptor.MemberInfo is not null)
System\ComponentModel\Design\Serialization\EnumCodeDomSerializer.cs (1)
38values = (Enum[])converter.ConvertTo(enumValue, typeof(Enum[]))!;
System.Windows.Forms.Design.Tests (3)
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (3)
328ResXDataNode node = new("Image1", converter.ConvertTo(bitmap, typeof(byte[]))); 408ResXDataNode node = new("Icon1", converter.ConvertTo(icon, typeof(byte[]))); 620ResXDataNode node = new("MediaPlayer1", converter.ConvertTo(mediaPlayer.OcxState, typeof(byte[])));
System.Windows.Forms.Tests (83)
System\Resources\ResxDataNodeTests.cs (2)
31ResXDataNode temp = new("test", converter.ConvertTo(bitmap, typeof(byte[]))); 45ResXDataNode temp = new("test", converter.ConvertTo(bitmap, typeof(byte[])));
System\Windows\Forms\ColumnHeaderConverterTests.cs (6)
97InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor))); 107Assert.Throws<ArgumentException>(() => converter.ConvertTo(value, typeof(InstanceDescriptor))); 116Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 123Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 130Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 139Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ColumnHeader(), destinationType));
System\Windows\Forms\CursorConverterTests.cs (16)
78Assert.Equal("AppStarting", converter.ConvertTo(Cursors.AppStarting, typeof(string))); 85Assert.Throws<FormatException>(() => converter.ConvertTo(new Cursor(2), typeof(string))); 94Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 101InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(Cursors.AppStarting, typeof(InstanceDescriptor))); 106Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new Cursor(Cursors.AppStarting.Handle), typeof(InstanceDescriptor))); 113Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new Cursor(2), typeof(InstanceDescriptor))); 120Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, typeof(InstanceDescriptor))); 130Assert.Equal(data, converter.ConvertTo(sourceCursor, typeof(byte[]))); 140Assert.Equal(data, converter.ConvertTo(sourceCursor, typeof(byte[]))); 147Assert.Throws<FormatException>(() => converter.ConvertTo(Cursors.AppStarting, typeof(byte[]))); 148Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(new Cursor(Cursors.AppStarting.Handle), typeof(byte[]))); 155Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(new Cursor(2), typeof(byte[]))); 162Assert.Empty(Assert.IsType<byte[]>(converter.ConvertTo(null, typeof(byte[])))); 169Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 178Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, destinationType)); 238string converted = (string)converter.ConvertTo(new Cursor(Cursors.Default.Handle), typeof(string));
System\Windows\Forms\DataGridViewRowConverterTests.cs (1)
27object descriptor = converter.ConvertTo(row, typeof(InstanceDescriptor));
System\Windows\Forms\KeysConverterTests.cs (1)
101object result = converter.ConvertTo(keys, typeof(Enum[]));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (12)
165string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 188string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 206string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 215string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 229string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 242Assert.Throws<InvalidOperationException>(() => converter.ConvertTo(settings, typeof(string))); 251string result = Assert.IsType<string>(converter.ConvertTo(settings, typeof(string))); 263Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string))); 274Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string))); 281Assert.Equal("1", converter.ConvertTo(1, typeof(string))); 288Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 299Assert.Throws<NotSupportedException>(() => converter.ConvertTo(toolStrip.LayoutSettings, destinationType));
System\Windows\Forms\LinkAreaConverterTests.cs (5)
76Assert.Equal("1, 2", converter.ConvertTo(new LinkArea(1, 2), typeof(string))); 85InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new LinkArea(1, 2), typeof(InstanceDescriptor))); 94Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 101Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 110Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(LinkArea), destinationType));
System\Windows\Forms\LinkConverterTests.cs (6)
74Assert.Equal("1, 2", converter.ConvertTo(new LinkLabel.Link(1, 2), typeof(string))); 83InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new LinkLabel.Link(1, 2), typeof(InstanceDescriptor))); 93InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new LinkLabel.Link(1, 2, "linkData"), typeof(InstanceDescriptor))); 103Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 110Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 119Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new LinkLabel.Link(), destinationType));
System\Windows\Forms\ListViewGroupConverterTests.cs (5)
203InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor))); 214Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 221Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 228Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 237Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewGroup(), destinationType));
System\Windows\Forms\ListViewItemConverterTests.cs (5)
258InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor))); 269Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 276Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 283Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 292Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewItem(), destinationType));
System\Windows\Forms\ListViewSubItemConverterTests.cs (5)
71InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor))); 82Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 89Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 96Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 105Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new ListViewItem.ListViewSubItem(), destinationType));
System\Windows\Forms\OpacityConverterTests.cs (4)
88Assert.Equal(expected, converter.ConvertTo(value, typeof(string))); 96Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 103Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 113Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1.1, destinationType));
System\Windows\Forms\PaddingConverterTests.cs (6)
79Assert.Equal("1, 2, 3, 4", converter.ConvertTo(new Padding(1, 2, 3, 4), typeof(string))); 88InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new Padding(1, 2, 3, 4), typeof(InstanceDescriptor))); 97InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new Padding(1, 1, 1, 1), typeof(InstanceDescriptor))); 106Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 113Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 122Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(Padding), destinationType));
System\Windows\Forms\TableLayoutPanelCellPositionTests.cs (4)
175InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(new TableLayoutPanelCellPosition(1, 2), typeof(InstanceDescriptor))); 185Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 192Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 201Assert.Throws<NotSupportedException>(() => converter.ConvertTo(default(TableLayoutPanelCellPosition), destinationType));
System\Windows\Forms\TableLayoutStyleTests.cs (5)
139InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(value, typeof(InstanceDescriptor))); 149Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new SubTableLayoutStyle { SizeType = sizeType }, typeof(InstanceDescriptor))); 156Assert.Throws<ArgumentNullException>("destinationType", () => converter.ConvertTo(new object(), null)); 163Assert.Throws<NotSupportedException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 172Assert.Throws<NotSupportedException>(() => converter.ConvertTo(new RowStyle(), destinationType));
System.Xaml.Tests (10)
System\Windows\Markup\StaticExtensionTests.cs (5)
216InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(extension, typeof(InstanceDescriptor))); 226InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(extension, typeof(InstanceDescriptor))); 227Assert.Equal(extension.ToString(), converter.ConvertTo(extension, typeof(string))); 235Assert.Throws<ArgumentException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 243Assert.Throws<NotSupportedException>(() => converter.ConvertTo(extension, typeof(int)));
System\Windows\Markup\TypeExtensionTests.cs (5)
177InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(extension, typeof(InstanceDescriptor))); 187InstanceDescriptor descriptor = Assert.IsType<InstanceDescriptor>(converter.ConvertTo(extension, typeof(InstanceDescriptor))); 188Assert.Equal(extension.ToString(), converter.ConvertTo(extension, typeof(string))); 196Assert.Throws<ArgumentException>(() => converter.ConvertTo(1, typeof(InstanceDescriptor))); 204Assert.Throws<NotSupportedException>(() => converter.ConvertTo(extension, typeof(int)));