コード例 #1
0
    public static T ReceivedOnly <T>(this T substitute, Quantity requiredQuantity) where T : class
    {
        if (!requiredQuantity.Matches(substitute.ReceivedCalls()))
        {
            throw new ReceivedCallsException(
                      ReceivedMessages.ReceivedDifferentCountThanExpectedCallsMessageFor(
                          substitute,
                          requiredQuantity.Describe("call total on this substitute", "calls total on this substitute")));
        }

        return(substitute.Received(requiredQuantity));
    }