Completed
Last Updated: 23 Jul 2018 13:47 by Nacho
Stefan
Created on: 23 Apr 2014 09:14
Type: Feature Request
3
Arrange return value of `new` expressions
I want to be able to arrange the return value of `new` expressions, like Mock.Arrange(() => new FileInfo()).Returns(mockFileInfo).
Then, I expect that `new FileInfo()` will always return my mock instance.
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
3 comments
Nacho
Posted on: 29 Apr 2014 12:26
Stefan,you are right, then the new FileInfo()).Returns(mockFileInfo) construction should allow the usage of the InSequence call.

Regards.
Stefan
Posted on: 29 Apr 2014 12:15
Is .InSequence() what you're looking for? http://www.telerik.bg/help/justmock/basic-usage-sequential-mocking.html
Nacho
Posted on: 23 Apr 2014 16:33
What would be really nice is to be able to specify what to return each time is called, something like:

Mock.Arrange(() => new FileInfo()).Returns(mockFileInfo).FirstTime();
Mock.Arrange(() => new FileInfo()).Returns(otherMockFileInfo).TimeCalled(2);