ConnectADummyClient() public méthode

Connect a Dummy client to the running server file.
public ConnectADummyClient ( ) : DummyLocalConnectedClient
Résultat DummyLocalConnectedClient
Exemple #1
0
        public void StopServer_ServerIsRunningWithConnectedClient_ReturnsFalse()
        {
            using (var db4OServerFile = new TemporaryDb4OServerFile(m_db4OServerInfo))
            {
                db4OServerFile.StartServer();

                using (var dummyLocalConnectedClient = db4OServerFile.ConnectADummyClient())
                {
                    Assert.IsFalse(m_db4OServerInfo.StopServer(db4OServerFile.ProjectName),
                                   "Server should not stop because a client is connected");
                }

                Assert.IsTrue(m_db4OServerInfo.StopServer(db4OServerFile.ProjectName),
                              "Server should stop because client is not connected - (this may be a unit test timing issue)");
            }
        }
Exemple #2
0
        public void ListConnectedClients_SingleConnectedClientDoNotSpecifyProjectName_ReturnsSingleClientIpAddress()
        {
            using (var db4OServerFile = new TemporaryDb4OServerFile(m_db4OServerInfo))
            {
                db4OServerFile.StartServer();

                int existingConnectedClientsCount = m_db4OServerInfo.ListConnectedClients().Count();

                using (var dummyClient = db4OServerFile.ConnectADummyClient())
                {
                    // The test.
                    Assert.AreEqual(existingConnectedClientsCount + 1, m_db4OServerInfo.ListConnectedClients().Count());
                }

                db4OServerFile.StopServer();
            }
        }
		public void ListConnectedClients_SingleConnectedClientDoNotSpecifyProjectName_ReturnsSingleClientIpAddress()
		{
			using (var db4OServerFile = new TemporaryDb4OServerFile(m_db4OServerInfo))
			{
				db4OServerFile.StartServer();

				int existingConnectedClientsCount = m_db4OServerInfo.ListConnectedClients().Count();

				using (var dummyClient = db4OServerFile.ConnectADummyClient())
				{
					// The test.
					Assert.AreEqual(existingConnectedClientsCount + 1, m_db4OServerInfo.ListConnectedClients().Count());
				}

				db4OServerFile.StopServer();
			}
		}
		public void StopServer_ServerIsRunningWithConnectedClient_ReturnsFalse()
		{
			using (var db4OServerFile = new TemporaryDb4OServerFile(m_db4OServerInfo))
			{
				db4OServerFile.StartServer();

				using (var dummyLocalConnectedClient = db4OServerFile.ConnectADummyClient())
				{
					Assert.IsFalse(m_db4OServerInfo.StopServer(db4OServerFile.ProjectName),
						"Server should not stop because a client is connected");
				}

				Assert.IsTrue(m_db4OServerInfo.StopServer(db4OServerFile.ProjectName),
					"Server should stop because client is not connected - (this may be a unit test timing issue)");
			}
		}