Convert() public méthode

Converts source values to a value for the binding target. The data binding engine calls this method when it propagates the values from source bindings to the binding target.
public Convert ( object values, Type targetType, object parameter, CultureInfo culture ) : object
values object The array of values that the source bindings in the produces. The value indicates that the source binding has no value to provide for conversion.
targetType System.Type The type of the binding target property.
parameter object The converter parameter to use.
culture System.Globalization.CultureInfo The culture to use in the converter.
Résultat object
        public void ExplorerItemModelToIconConverter_Convert_WithResourceTypeOfDbSource_CorrectBitmapImage()
        {
            Uri expected = new Uri("pack://application:,,,/Warewolf Studio;component/Images/DatabaseSource-32.png");
            //------------Setup for test--------------------------
            var explorerItemModelToIconConverter = new ExplorerItemModelToIconConverter();

            //------------Execute Test---------------------------
            object convert = explorerItemModelToIconConverter.Convert(new object[] { ResourceType.DbSource, false }, null, null, null);
            BitmapImage bitmapImage = convert as BitmapImage;
            //------------Assert Results-------------------------
            if(bitmapImage != null)
            {
                Assert.AreEqual(expected, bitmapImage.UriSource);
            }
            else
            {
                Assert.Fail("No BitmapImage was returned.");
            }
        }
 // ReSharper disable InconsistentNaming
 public void ExplorerItemModelToIconConverter_Convert_WithResourceTypeOfMessageNoImageReturned()
 // ReSharper restore InconsistentNaming
 {
     //------------Setup for test--------------------------
     var explorerItemModelToIconConverter = new ExplorerItemModelToIconConverter();
     //------------Execute Test---------------------------
     object convert = explorerItemModelToIconConverter.Convert(new object[] { ResourceType.Message, true }, null, null, null);
     BitmapImage bitmapImage = convert as BitmapImage;
     //------------Assert Results-------------------------
     Assert.IsNull(bitmapImage);
 }
        // ReSharper disable InconsistentNaming
        public void ExplorerItemModelToIconConverter_Convert_WithResourceTypeOfUnknown_CorrectBitmapImage()
        // ReSharper restore InconsistentNaming
        {
            Uri expected = new Uri("pack://application:,,,/Warewolf Studio;component/Images/Workflow-32.png");
            //------------Setup for test--------------------------
            var explorerItemModelToIconConverter = new ExplorerItemModelToIconConverter();

            //------------Execute Test---------------------------
            object convert = explorerItemModelToIconConverter.Convert(new object[] { ResourceType.Unknown, true }, null, null, null);
            BitmapImage bitmapImage = convert as BitmapImage;
            //------------Assert Results-------------------------
            if(bitmapImage != null)
            {
                Assert.AreEqual(expected, bitmapImage.UriSource);
            }
            else
            {
                Assert.Fail("No BitmapImage was returned.");
            }
        }
 public void ExplorerItemModelToIconConverter_Convert_WithResourceTypeOfVersion_NoImageReturned()
 {
     //------------Setup for test--------------------------
     var explorerItemModelToIconConverter = new ExplorerItemModelToIconConverter();
     //------------Execute Test---------------------------
     object convert = explorerItemModelToIconConverter.Convert(new object[] { ResourceType.Version, true }, null, null, null);
     BitmapImage bitmapImage = convert as BitmapImage;
     //------------Assert Results-------------------------
     Assert.IsNull(bitmapImage);
 }