public void CustomIDataErrorInfoImplementation() { IDataErrorInfo vm = CustomExplicitDataErrorInfoPropertyImplementation.Create(); var hwvm = new HandwrittenDataErrorInfoClass(); Assert.Equal(hwvm["StringProp"], vm["StringProp"]); Assert.Equal("custom error", vm.Error); }
public void CustomIDataErrorIndexerImplementation_Implicit() { IDataErrorInfo vm = CustomImplicitDataErrorInfoIndexerImplementation.Create(); var hwvm = new HandwrittenDataErrorInfoClass(); Assert.Equal("StringProp error", vm["StringProp"]); Assert.Equal(string.Empty, vm.Error); }
public void ImplementIDataErrorInfo() { var vm = AttributedDataErrorInfoClass.Create(); var asInfo = vm as IDataErrorInfo; var hwvm = new HandwrittenDataErrorInfoClass(); Assert.True(vm is IDataErrorInfo); Assert.Equal(hwvm[""], asInfo[""]); Assert.Equal(hwvm["StringProp"], asInfo["StringProp"]); Assert.Equal(hwvm.Error, asInfo.Error); vm.StringProp = ""; hwvm.StringProp = ""; Assert.Equal(hwvm["StringProp"], asInfo["StringProp"]); Assert.Equal(hwvm.Error, asInfo.Error); vm.StringProp = "123"; hwvm.StringProp = "123"; Assert.Equal(hwvm["StringProp"], asInfo["StringProp"]); Assert.Equal(hwvm.Error, asInfo.Error); }