Example #1
0
        internal static void TestMessages(AbstractClient C)
        {
            C.QueueMessage(P1);
            C.QueueMessage(P2);

            var Messages = C.GetMessages();

            C.QueueMessage(null);
            Assert.That(Messages.Count == 2, "Dummy client's message adding error! Null message should not be queued");
            Assert.That(Messages.Contains(P2), "Dummy client's message adding error!");
            Assert.False(Messages.Contains(P3), "Dummy client's message checking error!");

            // External modification must not affect internal operation
            Messages.Enqueue(P3);
            Assert.False(C.GetMessages().Contains(P3), "Dummy client's GetMessages should not return the internal list!");
        }
Example #2
0
 /// <summary>
 /// Take data from another client, the other client should be discarded shortly after so this
 /// instance can take oker
 /// </summary>
 /// <param name="Other">Client to take followers and messages from</param>
 public void TakeOverFrom(AbstractClient Other)
 {
     this.Followers = new HashSet<int>(Other.GetCurrentFollowers());
     this.Messages = new Queue<Payload>(Other.GetMessages());
 }
Example #3
0
        internal static void TestMessages(AbstractClient C)
        {
            C.QueueMessage(P1);
            C.QueueMessage(P2);

            var Messages = C.GetMessages();
            C.QueueMessage(null);
            Assert.That(Messages.Count == 2, "Dummy client's message adding error! Null message should not be queued");
            Assert.That(Messages.Contains(P2), "Dummy client's message adding error!");
            Assert.False(Messages.Contains(P3), "Dummy client's message checking error!");

            // External modification must not affect internal operation
            Messages.Enqueue(P3);
            Assert.False(C.GetMessages().Contains(P3), "Dummy client's GetMessages should not return the internal list!");
        }
Example #4
0
 /// <summary>
 /// Take data from another client, the other client should be discarded shortly after so this
 /// instance can take oker
 /// </summary>
 /// <param name="Other">Client to take followers and messages from</param>
 public void TakeOverFrom(AbstractClient Other)
 {
     this.Followers = new HashSet <int>(Other.GetCurrentFollowers());
     this.Messages  = new Queue <Payload>(Other.GetMessages());
 }