{"action":"closed","issue":{"url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/issues/82","repository_url":"https://api.github.com/repos/FakeItEasy/FakeItEasy","labels_url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/issues/82/comments","events_url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/issues/82/events","html_url":"https://github.com/FakeItEasy/FakeItEasy/issues/82","id":12519501,"number":82,"title":"Helper method for ordered assertions","user":{"login":"galaktor","id":1070055,"avatar_url":"https://avatars.githubusercontent.com/u/1070055?v=3","gravatar_id":"","url":"https://api.github.com/users/galaktor","html_url":"https://github.com/galaktor","followers_url":"https://api.github.com/users/galaktor/followers","following_url":"https://api.github.com/users/galaktor/following{/other_user}","gists_url":"https://api.github.com/users/galaktor/gists{/gist_id}","starred_url":"https://api.github.com/users/galaktor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galaktor/subscriptions","organizations_url":"https://api.github.com/users/galaktor/orgs","repos_url":"https://api.github.com/users/galaktor/repos","events_url":"https://api.github.com/users/galaktor/events{/privacy}","received_events_url":"https://api.github.com/users/galaktor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/labels/enhancement","name":"enhancement","color":"02e10c"},{"url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/labels/P3","name":"P3","color":"a349a7"},{"url":"https://api.github.com/repos/FakeItEasy/FakeItEasy/labels/wontifx","name":"wontifx","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2013-03-27T16:13:31Z","updated_at":"2016-02-06T04:21:30Z","closed_at":"2016-02-06T04:21:30Z","body":"I use a helper method to make ordered assertions (https://github.com/FakeItEasy/FakeItEasy/wiki/Ordered-assertions) more readable in my tests. It looks like so:\r\n\r\n```csharp\r\n/// <summary>\r\n/// Little helper to hide the FakeItEasy boilerplate for asserting calls in specific order.\r\n/// </summary>\r\nprivate void InOrder(Action act, Action assert)\r\n{\r\n\tusing(var scope = Fake.CreateScope())\r\n\t{\r\n\t\tact();\r\n\r\n\t\tusing(scope.OrderedAssertions())\r\n\t\t{\r\n\t\t\tassert();\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nUsed in a test, looks like this:\r\n\r\n```csharp\r\n[Test]\r\npublic void Receive_SomeCondition_FirstReceivesBeforeSecond()\r\n{\r\n\t// setup stuff\r\n\r\n\tInOrder(act: () => target.Receive(stuff),\r\n\r\n\tassert: () =>\r\n\t{\r\n\t\tA.CallTo(() => first.Receive(stuff)).MustHaveHappened();\r\n\t\tA.CallTo(() => second.Receive(stuff)).MustHaveHappened();\r\n\t});\r\n}\r\n```\r\nIt fits nicer into an arrange/act/assert scenario, and therefor reads much better than the naked boilerplate of creating scope.\r\n\r\nI suggest this be added to the FakeItEasy API (or something similar).\r\n"}}