Skip to content

Add Ordering to Expectations #380

@JasonBock

Description

@JasonBock

I'm been thinking about maybe adding an ordering feature when an expectation is set:

var expectations = new IWorkCreateExpectations();
expectations.Methods.Work().Order(1);
expectations.Methods.Perform().Order(0);

This would mean that Perform() would be called before Work().

What I also want to do is add features like this in using a "layering" approach. Right now I think Rocks provides a lean framework to mock types and set expectations. I don't want to add in features just because another framework provides it. I feel like that might bloat things. That said, this may be a case where the feature could be added in using configuration:

[assembly: Rock(typeof(IWork), BuildType.Create, ordering: AddOrdering.Yes)]

You'd have to opt-in to the feature, and then the code would be generated for that feature. I'm not sure if this would work, but that would keep things lean. Maybe I could also add in a way to configure this "globally" with project settings or an additional file. Not sure right now.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions