public void SatisfyImports_AttributedOverride_PartAndFalseHaveBeenPassed()
        {
            MockCompositionService compositionService = new MockCompositionService();
            object attributedPart = new MockAttributedPart();

            bool importsSatisfiedCalled = false;
            compositionService.ImportsSatisfied += delegate(object sender, SatisfyImportsEventArgs e)
            {
                Assert.IsFalse(importsSatisfiedCalled);
                Assert.IsTrue(e.Part is ReflectionComposablePart);
                Assert.IsTrue(((ReflectionComposablePart)e.Part).Definition.GetPartType() == typeof(MockAttributedPart));
                importsSatisfiedCalled = true;
            };

            compositionService.SatisfyImportsOnce(attributedPart);
            Assert.IsTrue(importsSatisfiedCalled);
        }
Example #2
0
        public void SatisfyImports_AttributedAndBooleanOverride_PartAndFalseHaveBeenPassed()
        {
            MockCompositionService compositionService = new MockCompositionService();
            object attributedPart = new MockAttributedPart();

            bool importsSatisfiedCalled = false;

            compositionService.ImportsSatisfied += delegate(object sender, SatisfyImportsEventArgs e)
            {
                Assert.False(importsSatisfiedCalled);
                Assert.True(e.Part is ReflectionComposablePart);
                Assert.True(((ReflectionComposablePart)e.Part).Definition.GetPartType() == typeof(MockAttributedPart));
                importsSatisfiedCalled = true;
            };

            compositionService.SatisfyImportsOnce(attributedPart);
            Assert.True(importsSatisfiedCalled);
        }