systemwrapper

How to mock 'out' parameter?

删除回忆录丶 提交于 2019-12-22 09:00:57
问题 I have downloaded the latest NSubstitute release, 1.1.0, May 21, 2011. Prior to this release, it seems that NSub did not support out parameters. It appears that some work has been done to provide support through an intermediate release: NSub Google Group. So, I am having a little trouble trying to get all the pieces working. I am using SystemWrapper to mock DirectoryInfo Here is my interface: public interface INetworkPath { void SetPath(string NetworkPath); bool TryGetDirectoryInfo(out

Mocking the Registry - SystemWrapper

好久不见. 提交于 2019-12-08 07:18:53
问题 I've tried following this as a guide for Mocking the registry: http://www.rhyous.com/2011/11/04/unit-testing-registry-access-with-rhinomocks-and-systemwrapper/ When I try to Mock it, I always get a null return for "reg" in my class when it tries to do the OpenSubKey call, in my _Real() test it works fine. Tests: private RegistryService CreateMockedRegistryService() { var registryService = new RegistryService(MockRepository.GenerateMock<ILoggerFacadeExtended>(), MockRepository.GenerateMock

Mocking the Registry - SystemWrapper

牧云@^-^@ 提交于 2019-12-07 18:57:20
I've tried following this as a guide for Mocking the registry: http://www.rhyous.com/2011/11/04/unit-testing-registry-access-with-rhinomocks-and-systemwrapper/ When I try to Mock it, I always get a null return for "reg" in my class when it tries to do the OpenSubKey call, in my _Real() test it works fine. Tests: private RegistryService CreateMockedRegistryService() { var registryService = new RegistryService(MockRepository.GenerateMock<ILoggerFacadeExtended>(), MockRepository.GenerateMock<IConnectivityService>()); // Mock the Base Key so we can throw errors and manipulate it registryService

How to mock 'out' parameter?

痴心易碎 提交于 2019-12-05 12:15:43
I have downloaded the latest NSubstitute release, 1.1.0, May 21, 2011. Prior to this release, it seems that NSub did not support out parameters. It appears that some work has been done to provide support through an intermediate release: NSub Google Group . So, I am having a little trouble trying to get all the pieces working. I am using SystemWrapper to mock DirectoryInfo Here is my interface: public interface INetworkPath { void SetPath(string NetworkPath); bool TryGetDirectoryInfo(out IDirectoryInfoWrap DirectoryInfo); } ...and the test: public void SetNetworkPath_SetDirectoryInfo() { var