Beispiel #1
0
        public void Test03_NoCondition()
        {
            StringCollection collection = new StringCollection();

            collection.Add("Buzz");
            collection.Add("Light");
            collection.Add("Year");

            Assert.AreEqual("Buzz", collection.First());
        }
Beispiel #2
0
        public void Test04_WithConditionNotMatched()
        {
            StringCollection collection = new StringCollection();

            collection.Add("Despicable");
            collection.Add("Me");
            collection.Add("Minion");
            collection.Add("BANANA");

            Assert.ThrowsException <InvalidOperationException>(() => collection.First(s => s.StartsWith("Ba")));
        }
Beispiel #3
0
        public void Test04_WithCondition()
        {
            StringCollection collection = new StringCollection();

            collection.Add("Buzz");
            collection.Add("Light");
            collection.Add("Year");
            collection.Add("Is");
            collection.Add("Yearning");

            Assert.AreEqual("Year", collection.First(s => s.StartsWith("Y")));
        }
Beispiel #4
0
        public void Test02_EmptyCollection()
        {
            StringCollection collection = new StringCollection();

            Assert.ThrowsException <InvalidOperationException>(() => collection.First());
        }
Beispiel #5
0
        public void Test01_NullReference()
        {
            StringCollection collection = default;

            Assert.ThrowsException <ArgumentNullException>(() => collection.First());
        }