Hello,
I got a question or sort of functionallity request.
After a little while working with JustMock, I found out that the Assert(action) communicates with Arrange(action).
I will show you a sample of how the code works how it is now
Well in the sample I got 3 module settings but in the real code i got like 12. Now I want to validate how much times it is cast with 1 code rule not 12. I thougth about the below solution but it always says it has been called once.
This woulth be a good solution because it saves me a lot of code. Hope this is possible some how or will be possible in the next update.
Thanks in advance,
Jeroen Speldekamp
I got a question or sort of functionallity request.
After a little while working with JustMock, I found out that the Assert(action) communicates with Arrange(action).
I will show you a sample of how the code works how it is now
//Arrange
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting1.Name)).Returns(moduleSetting1.Value).MustBeCalled();
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting2.Name)).Returns(moduleSetting2.Value).MustBeCalled();
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting3.Name)).Returns(moduleSetting3.Value).MustBeCalled();
//Act
_presenter.Load();
//Assert
Mock.Assert(() => _mock.ThisIsAMethod(module, moduleSetting1.Name), Occurs.Exactly(1));
Mock.Assert(() => _mock.ThisIsAMethod(module, moduleSetting2.Name), Occurs.Exactly(1));
Mock.Assert(() => _mock.ThisIsAMethod(module, moduleSetting3.Name), Occurs.Exactly(1));
Well in the sample I got 3 module settings but in the real code i got like 12. Now I want to validate how much times it is cast with 1 code rule not 12. I thougth about the below solution but it always says it has been called once.
//Arrange
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting1.Name)).Returns(moduleSetting1.Value).MustBeCalled();
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting2.Name)).Returns(moduleSetting2.Value).MustBeCalled();
Mock.Arrange(() => _mock.ThisIsAMethod(module, moduleSetting3.Name)).Returns(moduleSetting3.Value).MustBeCalled();
//Act
_presenter.Load();
//Assert
Mock.Assert(() => _mock.ThisIsAMethod(module, Arg.AnyString), Occurs.Exactly(3));
This woulth be a good solution because it saves me a lot of code. Hope this is possible some how or will be possible in the next update.
Thanks in advance,
Jeroen Speldekamp