public static void Main(string[] args) { using (FileStream file = new FileStream(SampleCommon.LoadTestLogFile, FileMode.Create, FileAccess.Write, FileShare.Read)) { using (logWriter = new StreamWriter(file)) { Log("LOG OPENED: " + DateTime.Now); // Generate the clients and the user uris that they'll use to authenticate with OCS. // These users must already exist in the test environment and be SIP-enabled. List <SimulatedClient> clients = new List <SimulatedClient>(); for (int i = SampleCommon.LoadTestFirstUserIndex; i <= SampleCommon.LoadTestLastUserIndex; i++) { SimulatedClient client = new SimulatedClient(SampleCommon.GetLoadTestUserUri(i), SampleCommon.GetLoadTestUserName(i), SampleCommon.GetLoadTestUserPassword(i)); clients.Add(client); } // Create new chat rooms. List <Uri> chatRooms = SetupChatRooms(clients); // Let user control when the test run starts. Console.WriteLine(); Console.WriteLine("Press any key to start the test, then press any key later to stop the test..."); Console.ReadKey(); // Start the connection process for each client. Once connected, each client will do work // (join chat rooms, chat, etc.) until they are told to Stop(). foreach (SimulatedClient client in clients) { // NOTE: Could wait a random delay here between each login. client.Start(chatRooms); } // Let user control when the test run stops. while (!Console.KeyAvailable) { Thread.Sleep(50); } Console.ReadKey(); // Stop all the objects and cleanup. foreach (SimulatedClient client in clients) { client.Stop(); } } } }
public static void getClient() { // Generate the clients and the user uris that they'll use to authenticate with Lync Server. // These users must already exist in the test environment and be SIP-enabled. for (int i = 2; i <= 5; i++) { SimulatedClient client = new SimulatedClient(SampleCommon.GetLoadTestUserUri(i), SampleCommon.GetLoadTestUserName(i), SampleCommon.GetLoadTestUserPassword(i)); Console.WriteLine("getClient:" + client.UserUri + " userName:"******" client:" + client.Password); clients.Add(client); } Console.WriteLine("Press any key to start the test, 已经加载的用户"); Console.ReadKey(); // Create new chat rooms. List <Uri> chatRooms = SetupChatRooms(clients); // Let user control when the test run starts. Console.WriteLine(); Console.WriteLine("Press any key to start the test, then press any key later to longin stop the test..."); Console.ReadKey(); // Start the connection process for each client. Once connected, each client will do work // (join chat rooms, chat, etc.) until they are told to Stop(). foreach (SimulatedClient client in clients) { Console.WriteLine("正在登陆:" + client.UserUri + " userName:"******" client:" + client.Password); // NOTE: Could wait a random delay here between each login. // client.Start(chatRooms); Console.ReadKey(); Console.WriteLine("登陆end:" + client.UserUri + " userName:"******" client:" + client.Password); } }