diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-11-15 20:39:48 +0100 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-15 11:39:48 -0800 |
commit | a6bbed029c64d2d64b74eeb67e27a099abf70664 (patch) | |
tree | 551c3924c055e2d39592b3f1c726cca46924dd73 /Xamarin.Forms.Core.UnitTests/MockViewModel.cs | |
parent | 14e21dcebd4a706aaa5eed384b142957d84df002 (diff) | |
download | xamarin-forms-a6bbed029c64d2d64b74eeb67e27a099abf70664.tar.gz xamarin-forms-a6bbed029c64d2d64b74eeb67e27a099abf70664.tar.bz2 xamarin-forms-a6bbed029c64d2d64b74eeb67e27a099abf70664.zip |
[XamlC] TypedBindings, some tests, a compiler, ... (#489)
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/MockViewModel.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/MockViewModel.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/MockViewModel.cs b/Xamarin.Forms.Core.UnitTests/MockViewModel.cs index da2f6f96..bdb3f7ef 100644 --- a/Xamarin.Forms.Core.UnitTests/MockViewModel.cs +++ b/Xamarin.Forms.Core.UnitTests/MockViewModel.cs @@ -3,28 +3,30 @@ using System.Runtime.CompilerServices; namespace Xamarin.Forms.Core.UnitTests { - internal class MockViewModel - : INotifyPropertyChanged + class MockViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; - string text; + public MockViewModel(string text=null) + { + _text = text; + } + + string _text; public virtual string Text { - get { return text; } + get { return _text; } set { - if (text == value) + if (_text == value) return; - text = value; + _text = value; OnPropertyChanged ("Text"); } } protected void OnPropertyChanged ([CallerMemberName] string propertyName = null) { - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) - handler (this, new PropertyChangedEventArgs (propertyName)); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs (propertyName)); } } -} +}
\ No newline at end of file |