Example #1
0
        public void GetPublicKeys()
        {
            List <string> users = new List <string>();

            users.Add("Joe");
            users.Add("Bob");

            PublicKeysRequestInitiator c = factory.CreateFromConversationType <PublicKeysRequestInitiator>();

            c.RemoteEndPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1027); // TODO - Make dynamic
            c.users          = users;
            c.Launch();
        }
Example #2
0
        public void ClientConversations()
        {
            // Test factory constructor
            ClientConversationFactory f = new ClientConversationFactory();

            Assert.IsNotNull(f);
            f.Initialize();

            // Test process initiator conversations
            ConnectToChatInitiator test1 = f.CreateFromConversationType <ConnectToChatInitiator>();

            Assert.IsNotNull(test1);
            test1.RemoteEndPoint = testEndpoint;
            test1.Launch();
            Assert.AreEqual(test1.RemoteEndPoint, testEndpoint);
            // What to assert on launch? Ask in code review

            ListServersRequestInitiator test2 = f.CreateFromConversationType <ListServersRequestInitiator>();

            Assert.IsNotNull(test2);
            test2.RemoteEndPoint = testEndpoint;
            test2.Launch();
            Assert.AreEqual(test2.RemoteEndPoint, testEndpoint);

            LoginRequestInitiator test3 = f.CreateFromConversationType <LoginRequestInitiator>();

            Assert.IsNotNull(test3);
            test3.RemoteEndPoint = testEndpoint;
            test3.Launch();
            Assert.AreEqual(test3.RemoteEndPoint, testEndpoint);

            PublicKeysRequestInitiator test4 = f.CreateFromConversationType <PublicKeysRequestInitiator>();

            Assert.IsNotNull(test4);
            test4.RemoteEndPoint = testEndpoint;
            test4.Launch();
            Assert.AreEqual(test4.RemoteEndPoint, testEndpoint);

            RegisterKeyRequestInitiator test5 = f.CreateFromConversationType <RegisterKeyRequestInitiator>();

            Assert.IsNotNull(test5);
            test5.RemoteEndPoint = testEndpoint;
            test5.Launch();
            Assert.AreEqual(test5.RemoteEndPoint, testEndpoint);


            // Test process responder conversations
            //   There are none to test
        }
 public void RunKeysUpdate()
 {
     while (isRunning)
     {
         List <string> UserIds = URM.GetUsersWithoutKeys();
         if (UserIds.Count > 0)
         {
             PublicKeysRequestInitiator c = factory.CreateFromConversationType <PublicKeysRequestInitiator>();
             c.RemoteEndPoint = KeyServerIPEndpoint;
             c.users          = UserIds;
             c.Launch();
             Thread.Sleep(5000);
         }
         else
         {
             Thread.Sleep(100);
         }
     }
 }