コード例 #1
0
    public void Initialization(BalloonType balloonType)
    {
        var childBlock = A.Dummy <IBlock>();
        var sut        = new BalloonNode(balloonType, childBlock);

        sut.BallonType.Should().Be(balloonType);
        sut.ChildBlock.Should().Be(childBlock);
    }
コード例 #2
0
        public Tester(BalloonType balloonType, bool isProtagonist)
        {
            var state = A.Dummy <INavigationState>();

            state.PersonName      = "alpha";
            state.ProtagonistName = isProtagonist ? "alpha" : "beta";

            var context = A.Fake <INavigationContext>(i => i.Strict());

            A.CallTo(() => context.State).Returns(state);

            var childBlock = A.Dummy <IBlock>();

            BalloonNode = new BalloonNode(balloonType, childBlock);
            Context     = context;
            Invoker     = new TestInvoker(context);
        }
コード例 #3
0
    public async Task ParseAsync(XmlReader reader, IParsingContext parsingContext, IParentParsingContext parentParsingContext)
    {
        var myContext = new BlockParentParsingContext();
        await elementParser.ParseAsync(reader, parsingContext, myContext, Settings);

        if (reader.ReadState != ReadState.EndOfFile)
        {
            await elementParser.ParseAsync(reader, parsingContext, myContext, AggregationSettings);
        }

        var nonPauseNodes = new Stack <INode>();

        for (var n = myContext.Nodes.Count - 1; n >= 0; n--)
        {
            var currentNode = myContext.Nodes[n];
            if (currentNode is IPauseNode)
            {
                break;
            }
            nonPauseNodes.Push(currentNode);
            myContext.Nodes.RemoveAt(n);
        }

        if (myContext.Nodes.Count == 0)
        {
            parsingContext.LogError(reader, "Era esperado um elemento filho.");
            return;
        }

        var block = parsingContext.BlockFactory.Create(myContext.Nodes);
        var node  = new BalloonNode(childParser.BalloonType, block);

        parentParsingContext.AddNode(node);

        while (nonPauseNodes.TryPop(out var nonPauseNode))
        {
            parentParsingContext.AddNode(nonPauseNode);
        }

        return;
    }