Reputation: 90535
I've seen samples using Moles to redirect DateTime.Now
but when I tried to redirect System.Net.Sockets.TcpClient.GetStream
I couldn't make the corresponding MTcpClient
appear on Intellisense.
Is there a limited number of classes which methods Moles can redirect? Is there any step that I missed?
Upvotes: 0
Views: 186
Reputation: 6556
First, it's System.Net.Sockets.Moles.MTcpClient
, don't forget the Moles
namespace.
Second, there seems to be a quirk when mocking Core.dll: after adding the .moles file for this assembly the usual way (by right-clicking the reference in Solution Explorer) you need to modify it to look like this:
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System" ExportedTypes="true" ReflectionOnly="true" />
</Moles>
or else you might get build errors as described in this question.
Upvotes: 1