0

I am using NetworkClient class to connect to the server. I need to do unit test for this part of the code. How can I write unit test for this function?

void Connect(NetworkClient ConnectDev ,String ConnDevIP, int ConnPort)
{
    ConnectDev.Connect(ConnDevIP, ConnPort);
}

I have tried something like this;

[TestMethod]
void ConnectTest()
{
    NetworkClient ConnectDev = new NetworkClient(); 
    String ConnDevIP = "myserverip";
    int ConnPort = 25000;       
    //Assert.AreEqual();
}
tuceo
  • 1
  • 1
  • well what exactly is it you want to test? That the IP is correct? That the port is correct? That a connection can actually be made? – derHugo May 17 '19 at 07:58

1 Answers1

0

You can use the Fake or stub object. You can use the link for more detailed information

What's the difference between faking, mocking, and stubbing?