Well, as web developers, we are always dealing with JSON data which are coming from different sources. Either we are serialising our entities, or it’s coming from the external sources like third-party services and so on.
With Visual Studio keep changing the way you create unit tests I thought I’d document down how to test a private method the easy way.
Here is a simple HomeController and we want to test that the GetPageSize method return 20 in a unit test.
Not my fix, but it works
@ECHO OFF :IE10HACK REG ADD “HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer” /v Version /t REG_SZ /d “9.10.9200.16384” /f REG ADD “HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer” /v svcVersion /t REG_SZ /d “10.0.9200.16384” /f REG ADD “HKLM\SOFTWARE\Microsoft\Internet Explorer” /v Version /t REG_SZ /d “9.10.9200.16384” /f REG ADD “HKLM\SOFTWARE\Microsoft\Internet Explorer” /v svcVersion /t REG_SZ /d “10.0.9200.16384” /f GOTO EXIT
:REVERTIE REG DELETE “HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer” /v svcVersion REG DELETE “HKLM\SOFTWARE\Microsoft\Internet Explorer” /v svcVersion REG ADD “HKLM\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer” /v Version /t REG_SZ /d “8.0.7601.17514” /f REG ADD “HKLM\SOFTWARE\Microsoft\Internet Explorer” /v Version /t REG_SZ /d “8.0.7601.17514” /f GOTO EXIT
:EXIT