This is a migrated thread and some comments may be shown as answers.

Does InSequence work for ArrangeSet?

1 Answer 51 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 01 Oct 2014, 05:53 PM
I have a mocked class which has a bool property BoolProperty.
I have a class under test with a method under test which first sets BoolProperty to true, and then to false.
I wish to set up an arrangement which tests that these two calls are made in the correct order, which I have done as follows:

    mockedClass.ArrangeSet(x => x.BoolProperty = true).InSequence();
    mockedClass.ArrangeSet(x => x.BoolProperty = false).InSequence();

This passes the test fine. However, if I reverse the order:

    mockedClass.ArrangeSet(x => x.BoolProperty = false).InSequence();
    mockedClass.ArrangeSet(x => x.BoolProperty = true).InSequence();

this *also* passes.
Shouldn't this second arrangement cause the test to fail?

I am using JustMock 2014.1.1424.1

1 Answer, 1 is accepted

Sort by
0
Dave
Top achievements
Rank 1
answered on 02 Oct 2014, 12:02 PM
Apologies, I've answered this myself - I was confused between the functionality of InSequence and of InOrder. InOrder was what I needed.
Tags
General Discussions
Asked by
Dave
Top achievements
Rank 1
Answers by
Dave
Top achievements
Rank 1
Share this question
or