You're right in that I don't want to actually connect to a bunch of ports. In
fact, I don't want to perform the socket operations at all. Only fake them, so
as to test the code I wrote Since I wrote the original message, I've kept
working with this, and ended up trying to implement a Stub with a .Do()
delegate. Unfortunately, the line with the .Do() still threw the no last call
exception.
I have not looked at TcpClient, although I will do so, for the future. I am
unable to change the design to switch classes at this point in time, as the
project is moving against a very tight deadline.
An example that I want to test is similar to the following:
Class SocketUser
{
Start()
{
Socket.BeginAccept(...,CallBackToMyFunction,...);
}
private MyCallBackFunction(...)
{
// Do Stuff
}
}
I want to test the Start() function and thereby the MyCallBackFunction, without
having to actually start a listen port and open up sockets.
I hope this makes things clearer. If I'm at a fairly remedial level, and
there's just some RTFM I need to do, let me kno.
Seth C
From: [email protected] [mailto:[email protected]] On
Behalf Of Tim Barcz
Sent: Monday, August 24, 2009 11:12 PM
To: [email protected]
Subject: [RhinoMocks] Re: Mocking Sockets
I've done quite a bit of testing around sockets in an application I wrote...so
I will try to be of assistance. Before we do that let's back up a moment and
let me ask what you're trying to do? What is the scenario you want to test?
You don't actually want your test to go out and connect to a bunch of ports do
you?
(Also on another topic, I see you're using Socket and Tcp as the protocol, have
you looked int TcpClient class which sits on top of Socket?)
On Fri, Aug 21, 2009 at 2:13 PM, Seth Corduan
<[email protected]<mailto:[email protected]>> wrote:
Hello All,
Attention: This message and all attachments are private and may contain
information that is confidential and privileged. If you received this
message in error, please notify the sender by reply email and delete
the message immediately.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---