diff options
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/MockViewModel.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/MockViewModel.cs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/MockViewModel.cs b/Xamarin.Forms.Core.UnitTests/MockViewModel.cs new file mode 100644 index 00000000..da2f6f96 --- /dev/null +++ b/Xamarin.Forms.Core.UnitTests/MockViewModel.cs @@ -0,0 +1,30 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace Xamarin.Forms.Core.UnitTests +{ + internal class MockViewModel + : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + string text; + public virtual string Text { + get { return text; } + set { + if (text == value) + return; + + text = value; + OnPropertyChanged ("Text"); + } + } + + protected void OnPropertyChanged ([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler handler = PropertyChanged; + if (handler != null) + handler (this, new PropertyChangedEventArgs (propertyName)); + } + } +} |