public void BindToTypeConversionSmokeTest() { var vm = new PropertyBindViewModel(); var view = new PropertyBindView() { ViewModel = null }; view.WhenAny(x => x.ViewModel.JustADouble, x => x.Value) .BindTo(view, x => x.FakeControl.NullHatingString); Assert.Equal("", view.FakeControl.NullHatingString); view.ViewModel = vm; Assert.Equal(vm.JustADouble.ToString(), view.FakeControl.NullHatingString); }
public void ItemsControlShouldGetADataTemplateInBindTo() { var vm = new PropertyBindViewModel(); var view = new PropertyBindView() { ViewModel = vm }; configureDummyServiceLocator(); Assert.Null(view.FakeItemsControl.ItemTemplate); vm.WhenAny(x => x.SomeCollectionOfStrings, x => x.Value) .BindTo(view, v => v.FakeItemsControl.ItemsSource); Assert.NotNull(view.FakeItemsControl.ItemTemplate); view.WhenAny(x => x.FakeItemsControl.SelectedItem, x => x.Value) .BindTo(vm, x => x.Property1); }