示例#1
0
        public void MatchShouldInvokeLeafFuncWhenIdRepresentsLeaf()
        {
            // Arrange
            Id id = new Id.Leaf(0);

            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.Received().Invoke(0);
            nodeFn.DidNotReceiveWithAnyArgs();
        }
示例#2
0
        public void MatchShouldInvokeLeafActionWhenIdRepresentsLeaf()
        {
            // Arrange
            Id id = new Id.Leaf(0);

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

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

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