public void Configuration_GetDataContextWithOtherTypeThanAsked_DataContextIsReturned() { var viewmodel = Substitute.For<IViewModel>(); var view = new View(viewmodel); Assert.Throws<UnexpectedDataContextException>(() => { var vm = view.As<IOtherViewModel>(); Assert.IsInstanceOf<IViewModel>(vm); }); }
public void Configuration_GetDataContext_DataContextIsReturned() { var viewmodel = Substitute.For<IViewModel>(); var view = new View(viewmodel); var vm = view.As<IViewModel>(); }
public void Configuration_GetDataContextWithNull_DataContextIsReturned() { var viewmodel = Substitute.For<IViewModel>(); var view = new View(); Assert.Throws<NullDataContextException>(() => view.As<IOtherViewModel>()); }