public void ObjectToTextConverter_Dynamic_Class_ParameterOverride() { IValueConverter target = new ObjectToTextConverter { Key = "keyxx" }; Assert.AreEqual("This is a class", target.Convert(new Class(), null, "key", null)); }
private void OnSelectedColorThemeChanged() { _themeContainer.Clear(); var relativeUri = ObjectToTextConverter.Convert(DictionaryUriKey, SelectedColorTheme); if (relativeUri.IsNullOrEmpty()) { return; } _themeContainer.Add(new ResourceDictionary { Source = GetType().Assembly.GeneratePackUri(relativeUri) }); }
public void ObjectToTextConverter_Dynamic_Class_BadKey() { IValueConverter target = new ObjectToTextConverter { Key = "keyxx" }; Assert.AreEqual("TomsToolbox.Wpf.Tests.Converters.ObjectToTextConverterTests+Class", target.Convert(new Class(), null, null, null)); }
public void ObjectToTextConverter_Static_Enum() { Assert.AreEqual("This is item 1", ObjectToTextConverter.Convert("key1", Items.Item1)); Assert.AreEqual("This is other text on item 1", ObjectToTextConverter.Convert("key2", Items.Item1)); Assert.AreEqual("This is item 2", ObjectToTextConverter.Convert("key1", Items.Item2)); }