Ejemplo n.º 1
0
        public void AboutWindowFactory_IsExportedViaMef()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            Assert.IsNotNull(mefImport.Target);
        }
Ejemplo n.º 2
0
        public void AboutWindowFactory_ImplementsFactoryT1Interface()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            Assert.IsNotNull(mefImport.Target);
            Assert.IsInstanceOfType(mefImport.Target, typeof(IFactory <AboutWindow>));
        }
Ejemplo n.º 3
0
        public void AboutWindowFactory_Get_DoesNotReturnNull()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            var instance = mefImport.Target.Get();

            Assert.IsNotNull(instance);
        }
Ejemplo n.º 4
0
        public void AboutWindowFactory_Get_Max1UniqueInstance()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            var expected = mefImport.Target.Get();
            var actual   = mefImport.Target.Get();

            Assert.AreSame(expected, actual);
        }
Ejemplo n.º 5
0
        public void AboutWindowFactory_Get_HasExpectedDataContext()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);
            var expected = mefImport.ViewModel;

            var instance = mefImport.Target.Get();

            var actual = instance.DataContext as AboutViewModel;

            Assert.IsNotNull(actual);
            Assert.AreSame(expected, actual);
        }
Ejemplo n.º 6
0
        public void AboutWindowFactory_Get_ReturnsNewInstanceIfWindowWasClosed()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);
            var notExpected = mefImport.Target.Get();

            notExpected.Close();

            var actual = mefImport.Target.Get();

            Assert.AreNotSame(notExpected, actual);
            Assert.IsNotNull(notExpected);
            Assert.IsNotNull(actual);
        }