Esempio n. 1
0
        public void WhenViewRequested_ThenReturnsFromContainer()
        {
            var catalog = new TypeCatalog(typeof(TestView));
            var container = new CompositionContainer(catalog);

            var viewFactory = new ViewFactory(container);

            var view = viewFactory.GetView("TestView");
            Assert.IsNotNull(view);
        }
Esempio n. 2
0
        public void WhenNonExistingVeiwRequested_ThenThrowsException()
        {
            var catalog = new TypeCatalog(typeof(TestView));
            var container = new CompositionContainer(catalog);

            var viewFactory = new ViewFactory(container);

            ExceptionAssert.Throws<Exception>(
                () =>
                {
                    viewFactory.GetView("NonExistentView");
                }
            );
        }