Does InSequence work for ArrangeSet?

2 posts, 0 answers
  1. Dave
    Dave avatar
    31 posts
    Member since:
    Apr 2014

    Posted 01 Oct 2014 Link to this post

    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
  2. Dave
    Dave avatar
    31 posts
    Member since:
    Apr 2014

    Posted 02 Oct 2014 in reply to Dave Link to this post

    Apologies, I've answered this myself - I was confused between the functionality of InSequence and of InOrder. InOrder was what I needed.
  3. DevCraft R3 2016 release webinar banner
Back to Top