Ejemplo n.º 1
0
            public void FindsDocumentInChildOfParentContext()
            {
                // Given
                TestDocument a  = new TestDocument();
                TestDocument b  = new TestDocument();
                TestDocument c  = new TestDocument();
                TestDocument d  = new TestDocument();
                TestDocument e  = new TestDocument();
                TestDocument e1 = new TestDocument();
                TestDocument e2 = new TestDocument();
                TestDocument e3 = new TestDocument();

                e.Add(Keys.Children, new IDocument[] { e1, e2, e3 });
                TestDocument         f       = new TestDocument();
                TestExecutionContext parent  = new TestExecutionContext(d, e, f);
                TestExecutionContext context = new TestExecutionContext(a, b, c);

                context.Parent = parent;
                LazyDocumentMetadataValue value = new LazyDocumentMetadataValue(e2);

                // When
                object result = value.Get(null);

                // Then
                result.ShouldBe(e2);
                IExecutionContext.Current.ShouldBe(context); // Sanity check
            }
Ejemplo n.º 2
0
            public void FindsDocumentInChildren()
            {
                // Given
                TestDocument a  = new TestDocument();
                TestDocument b  = new TestDocument();
                TestDocument b1 = new TestDocument();
                TestDocument b2 = new TestDocument();
                TestDocument b3 = new TestDocument();

                b.Add(Keys.Children, new IDocument[] { b1, b2, b3 });
                TestDocument              c       = new TestDocument();
                TestExecutionContext      context = new TestExecutionContext(a, b, c);
                LazyDocumentMetadataValue value   = new LazyDocumentMetadataValue(b2);

                // When
                object result = value.Get(null);

                // Then
                result.ShouldBe(b2);
            }