Skip to content

Reduce the Capacity of the Handler List Creation #293

Closed
@JasonBock

Description

Describe the solution you'd like

Whenever I create a handler list, I use the default size (which is 4 as of .NET 8....I think it's been that way for a while):

private readonly global::System.Collections.Generic.List<global::Rocks.Handler> @handlers0 = new();

I think the typical usage of a mock is to only set one or two expectations. So, maybe the correct thing to do is to set them all to 2:

private readonly global::System.Collections.Generic.List<global::Rocks.Handler> @handlers0 = new(2);

Maybe even setting it to 1 would be ideal. Not sure. Maybe having an optional parameter for the expectation creation would allow users to set the capacity size, but....I'm not sure that's worth it.

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions