public void Initialize()
 {
     context = new FileContext("test", new MemoryStream());
     sectionContextStub = new SectionContextStub(context);
     childTargetMapMock = new Mock<IClassMap<ChildTarget,FileContext>>();
     childTargetMapMock.Setup(m => m.ExtractAsync(It.IsAny<FileContext>(), It.IsAny<ChildTarget>()))
         .Returns(Task.Delay(0));
     parentTarget = new ParentTarget();
     childTargets = new[] { new ChildTarget(), new ChildTarget() };
     endOfSectionPredicate = c => false;
     map = new ComponentMap<ParentTarget, ChildTarget, FileContext>(p => p.Children,
         c => sectionContextStub, () => childTargets[childIndex++], childTargetMapMock.Object,
         c => endOfSectionPredicate(c));
 }
Exemplo n.º 2
0
        public IqResult CreateResult(IqTarget target)
        {
            var result = Workflow.CreateIQResult(target);

            if (target.HasParent)
            {
                if (ParentTarget.GetResult() == null)
                {
                    ParentTarget._result = ParentTarget.CreateResult();
                }
                result.ParentResult = ParentTarget._result;
                ParentTarget._result.AddResult(result);
            }

            return(result);
        }