Esempio n. 1
0
        public void MatchShouldInvokeLeafFuncWhenNodeRepresentsLeaf()
        {
            // Arrange
            Event e = new Event.Leaf(0);

            Func <int, object> leafFn = Substitute.For <Func <int, object> >();
            Func <int, Event, Event, object> nodeFn = Substitute.For <Func <int, Event, Event, object> >();

            // Act
            e.Match(leafFn, nodeFn);

            // Assert
            leafFn.Received().Invoke(0);
            nodeFn.DidNotReceiveWithAnyArgs();
        }
Esempio n. 2
0
        public void MatchShouldInvokeLeafActionWhenEventRepresentsLeaf()
        {
            // Arrange
            Event e = new Event.Leaf(0);

            Action <int> leafAction = Substitute.For <Action <int> >();
            Action <int, Event, Event> nodeAction = Substitute.For <Action <int, Event, Event> >();

            // Act
            e.Match(leafAction, nodeAction);

            // Assert
            leafAction.Received().Invoke(0);
            nodeAction.DidNotReceiveWithAnyArgs();
        }