Skip to content

Commit 08ce999

Browse files
committed
Add a test to verify type conversion works
1 parent 3123706 commit 08ce999

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ReactiveUI.Tests/PropertyBindingTest.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,21 @@ public void BindToShouldntInitiallySetToNull()
336336
Assert.Equal(vm.Model.AnotherThing, view.FakeControl.NullHatingString);
337337
}
338338

339+
[Fact]
340+
public void BindToTypeConversionSmokeTest()
341+
{
342+
var vm = new PropertyBindViewModel();
343+
var view = new PropertyBindView() {ViewModel = null};
344+
345+
view.WhenAny(x => x.ViewModel.JustADouble, x => x.Value)
346+
.BindTo(view, x => x.FakeControl.NullHatingString);
347+
348+
Assert.Equal("", view.FakeControl.NullHatingString);
349+
350+
view.ViewModel = vm;
351+
Assert.Equal(vm.JustADouble.ToString(), view.FakeControl.NullHatingString);
352+
}
353+
339354
void configureDummyServiceLocator()
340355
{
341356
var types = new Dictionary<Tuple<Type, string>, List<Type>>();

0 commit comments

Comments
 (0)