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

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

            Assert.AreEqual("Light", collection.Last());
        }
示例#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.Last(s => s.StartsWith("Gru")));
        }
示例#3
0
        public void Test04_WithCondition()
        {
            StringCollection collection = new StringCollection();

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

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

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

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