InOrder Implementation
Hello @kaste, as we discussed in in issue #97 there isn't an implementation for InOrder. I would like to implement it but I need your opinion.
I think we should be able write something like this:
in_order: inOrder = inOrder(first_mock, second_mock)
in_order.verify(first_mock.a_method())
in_order.verify(second_mock.other_method())
The idea is to use the in_order object as a container to remember the invocations during the test of differents mocks using the methods already implemented in verify and the data structure of Mock that remembers the invocations.
What do you think?
in_order.verify(first_mock.a_method()) calls rv = first.method() and then calls in_order.verify(rv).
How do you want to implement that?
in_order.verify(first_mock.a_method())callsrv = first.method()and then callsin_order.verify(rv). I made a mistake, the call is the same as the actualverify
in_order.verify(first_mock).a_method()
I have extended the Mock to be Observable, so every time the invocations list gets updated it notifies the Observer i.e. the inOrder object.
I wrote two tests, one with a correct order specification and one with the wrong specification. Both are green and all other tests too (6 tests are ignored even before my edits).
This is just a poc for now since I have to think of more cases.
I will open the PR just to let you know what I'm doing
Best Regards