예제 #1
0
        public void MatchShouldInvokeNodeFuncWhenIdRepresentsNode()
        {
            // Arrange
            Id id = new Id.Node(0, 1);

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

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

            // Assert
            leafFn.DidNotReceiveWithAnyArgs();
            nodeFn.Received().Invoke(0, 1);
        }
예제 #2
0
        public void MatchShouldInvokeNodeActionWhenIdRepresentsNode()
        {
            // Arrange
            Id id = new Id.Node(0, 1);

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

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

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