예제 #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);
        }
예제 #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");
                }
            );
        }