예제 #1
0
        public void ManagementWindowFactory_IsExportedViaMef()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            Assert.IsNotNull(mefImport.Target);
        }
예제 #2
0
        public void ManagementWindowFactory_ImplementsFactoryT1Interface()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            Assert.IsNotNull(mefImport.Target);
            Assert.IsInstanceOfType(mefImport.Target, typeof(IFactory <ManagementWindow>));
        }
예제 #3
0
        public void ManagementWindowFactory_Get_DoesNotReturnNull()
        {
            var container = MefTestUtils.CreateMefContainer();
            var mefImport = new MefImportTestHelper();

            container.ComposeParts(mefImport);

            var instance = mefImport.Target.Get();

            Assert.IsNotNull(instance);
        }
예제 #4
0
        public void ManagementWindowFactory_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);
        }
예제 #5
0
        public void ManagementWindowFactory_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 MainViewModel;

            Assert.IsNotNull(actual);
            Assert.AreSame(expected, actual);
        }
예제 #6
0
        public void ManagementWindowFactory_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);
        }