public void Server_SendMessage_ReturnsFalseIfException() { //arrange var tcpManager = new StubITcpServerManager { SendMessageIEnumerableOfTcpClientActionOfStringString = (sender, messgeHandler, message) => { throw new Exception(); } }; var server = new Server(tcpManager); //act var result = server.SendMessage("test message"); //assert // no excetion Assert.IsFalse(result); }
public void AppFactory_GetEchoApp_ReturnsCorrectMode() { //Arrange var clientManager = new StubITcpClientManager(); var serverManager = new StubITcpServerManager(); var clientApp = new StubClient(clientManager); var serverApp = new StubServer(serverManager); var appFacory = new EchoAppFactory(clientApp, serverApp); //Act var factoryClient = appFacory.GetEchoApp(RunMode.Client); var factoryServer = appFacory.GetEchoApp(RunMode.Server); //Assert Assert.AreEqual(factoryClient, clientApp); Assert.AreEqual(factoryServer, serverApp); Assert.AreNotEqual(factoryServer, clientApp); }