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?
First, it’s
System.Net.Sockets.Moles.MTcpClient, don’t forget theMolesnamespace.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:
or else you might get build errors as described in this question.