예제 #1
0
 public void GetEnumeratorTest()
 {
     TestLauncherActor.Test(() =>
     {
         var act = new EnumerableActor <string>();
         act.Add("test1");
         act.Add("test2");
         var list = new List <string>();
         foreach (var item in act)
         {
             list.Add(item);
         }
         Assert.AreEqual(2, list.Count);
         Assert.AreEqual(2, act.Count());
     });
 }
 public void GetEnumeratorTest()
 {
     fLauncher.SendAction(() =>
     {
         var act = new EnumerableActor<string>();
         act.Add("test1");
         act.Add("test2");
         var list = new List<string>();
         foreach(var item in act)
         {
             list.Add(item);
         }
         Assert.AreEqual(2, list.Count);
         Assert.AreEqual(2, act.Count());
         fLauncher.Finish();
     });
     Assert.IsTrue(fLauncher.Wait());
 }
예제 #3
0
        public void StressEnumeratorWithLinqTest()
        {
            TestLauncherActor.Test(() =>
            {
                var act = new EnumerableActor <string>();

                foreach (var item in Enumerable.Range(0, 100))
                {
                    act.Add(item.ToString());
                }
                Assert.AreEqual(100, act.Count());
                var query =
                    from s in act
                    where s.StartsWith("1")
                    select s;
                Assert.AreEqual(11, query.Count());
                Assert.IsTrue(query.Contains("11"));
            });
        }