示例#1
0
 public void RandomTest()
 {
     Bag<string> BagObject = new Bag<string>();
     Utilities.Random.Random Rand = new Utilities.Random.Random();
     for (int x = 0; x < 10; ++x)
     {
         string Value = Rand.Next<string>(new RegexStringGenerator(10));
         int Count = Rand.Next(1, 10);
         for(int y=0;y<Count;++y)
             BagObject.Add(Value);
         Assert.Equal(Count, BagObject[Value]);
     }
     Assert.Equal(10, BagObject.Count);
 }
 public void RandomTest()
 {
     var BagObject = new Bag<string>();
     var Rand = new System.Random();
     for (int x = 0; x < 10; ++x)
     {
         string Value = x.ToString();
         int Count = Rand.Next(1, 10);
         for (int y = 0; y < Count; ++y)
             BagObject.Add(Value);
         Assert.Equal(Count, BagObject[Value]);
     }
     Assert.Equal(10, BagObject.Count);
 }