Beispiel #1
0
 public void NoPType() {
   MockDataHandler idh = new MockDataHandler();
   MockSender mspr = new MockSender(null, null, idh, 0);
   byte[] data = new byte[1024];
   RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
   rng.GetBytes(data);
   MemBlock mdata = MemBlock.Reference(data);
   mspr.Send(mdata);
   Assert.AreEqual(mdata, idh.LastReceived, "No PType MockSender");
 }
Beispiel #2
0
    public void test() {
      MockDataHandler mdh = new MockDataHandler();
      mdh.HandleDataCallback += Callback;
      ISender sender = new MockSender(null, null, mdh, 0);
      byte[][] b = new byte[10][];
      MemBlock[] mb = new MemBlock[10];
      Random rand = new Random();
      for(int i = 0; i < 10; i++) {
        b[i] = new byte[128];
        rand.NextBytes(b[i]);
        mb[i] = MemBlock.Reference(b[i]);
        sender.Send(mb[i]);
      }

      for(int i = 0; i < 10; i++) {
        Assert.AreEqual(i, mdh.Position(mb[i]), "Position " + i);
        Assert.IsTrue(mdh.Contains(mb[i]), "Contains " + i);
      }

      Assert.AreEqual(_count, 10, "Count");
    }