SvetlovA / static-mock

SMock is opensource lib for mocking static and instance methods and properties.
https://svetlova.github.io/static-mock/
MIT License
10 stars 3 forks source link

Task function unit test exception #4

Closed kyohaifeng closed 3 years ago

kyohaifeng commented 3 years ago

Hi, @SvetlovA ,The following exception occurred when using the function of Setup(Type type, string methodName, Action action) to unit test a task function, but these is ok when using the function of generic Setup.

キャプチャ
SvetlovA commented 3 years ago

Hello, @kyohaifeng, Can you tell which OS you run this test? Because I added pipelines to run tests on different OS(Windows, Ubuntu, MacOS) and I saw that same issues reproduced on Ubuntu and MacOS, but for Windows is OK https://github.com/SvetlovA/static-mock/actions/runs/1007386703.

kyohaifeng commented 3 years ago

Hi, @SvetlovA ,I tested it by Windows OS with X64 and X86 platform,but all of them were Exceptional Sorry, I used debug mode to test, so there was an exception. When using run mode, there is no problem with testing. I don't understand why there are exceptions in debug mode

SvetlovA commented 3 years ago

It depends on many different things. Compiler use some optimizations in Release mode. Also it depends on your processor architecture. Can you send me your processor info like in screen? And I will try to reproduce and fix it image

SvetlovA commented 3 years ago

I fixed it. This was error in tests. Return type of method is Task\<int>, but we try to mock int. Ubuntu and MacOS fail tests on run as expected. But it is really interesting Windows behavior, that we can see error only in debug mode. Fix commit: https://github.com/SvetlovA/static-mock/commit/8b396ff5c0d22d3b3b625dceeb6b4d782808e182 Test results: https://github.com/SvetlovA/static-mock/actions/runs/1011695756

kyohaifeng commented 3 years ago

@SvetlovA ,Hi, this is my computer spec.

キャプチャ