Exemple #1
0
 public void IndexOf()
 {
     Assert.AreEqual(0, _array.IndexOf("one"));
     Assert.AreEqual(1, _array.IndexOf("two"));
     Assert.AreEqual(2, _array.IndexOf("three"));
     Assert.AreEqual(-1, _array.IndexOf("seven"));
 }
        public void RandomIndexOfTests()
        {
            var i = 0;

            for (i = 0; i < 100000; i++)
            {
                var s     = randomSubstring();
                var start = _rnd.Next(_normalString.Length - 1);

                Assert.That(_sa.IndexOf(s, start), Is.EqualTo(_normalString.IndexOf(s, start, StringComparison.Ordinal)),
                            string.Format(i + ": start {1}, str \"{0}\"", s, start));
            }
        }