Exemplo n.º 1
0
        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);
            });
        }
Exemplo n.º 2
0
        public void Configuration_GetDataContext_DataContextIsReturned()
        {
            var viewmodel = Substitute.For<IViewModel>();
            var view = new View(viewmodel);

            var vm = view.As<IViewModel>();
        }
Exemplo n.º 3
0
        public void Configuration_GetDataContextWithNull_DataContextIsReturned()
        {
            var viewmodel = Substitute.For<IViewModel>();
            var view = new View();

            Assert.Throws<NullDataContextException>(() => view.As<IOtherViewModel>());
        }