diff options
author | Eric Maupin <ermaup@microsoft.com> | 2017-12-13 23:54:30 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2018-01-05 22:43:43 +0300 |
commit | 8e68fa3ac132d7c9a5e6ffb3aea8d7621721cb59 (patch) | |
tree | aff85af5c8429911dcb075fdd3b6ffe85940ba01 /Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs | |
parent | 14e0d19cf4b2a7f75aae3606867909753e419163 (diff) |
[Core] Allow for null editors
Diffstat (limited to 'Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs b/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs index 49db7c5..a839ce0 100644 --- a/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs +++ b/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs @@ -1,4 +1,6 @@ -using System.Linq; +using System; +using System.Linq; +using System.Threading.Tasks; using Moq; using NUnit.Framework; using Xamarin.PropertyEditing.Reflection; @@ -28,6 +30,30 @@ namespace Xamarin.PropertyEditing.Tests } } + private Exception unhandled; + [SetUp] + public void Setup () + { + AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; + } + + [TearDown] + public void TearDown () + { + AppDomain.CurrentDomain.UnhandledException -= CurrentDomainOnUnhandledException; + + if (this.unhandled != null) { + var ex = this.unhandled; + this.unhandled = null; + Assert.Fail ("Unhandled exception: {0}", ex); + } + } + + private void CurrentDomainOnUnhandledException (object sender, UnhandledExceptionEventArgs e) + { + this.unhandled = e.ExceptionObject as Exception; + } + [Test] public void TypeName () { @@ -459,6 +485,16 @@ namespace Xamarin.PropertyEditing.Tests Assert.That (vm.Events.Count, Is.EqualTo (0)); } + [Test] + [Description ("The IEditorProvider should be able to return null editors")] + public void NullEditorAdded () + { + var providerMock = new Mock<IEditorProvider> (); + + var vm = CreateVm (providerMock.Object); + vm.SelectedObjects.Add (null); + } + internal abstract PropertiesViewModel CreateVm (IEditorProvider provider); } }
\ No newline at end of file |