Esempio n. 1
0
        public void Method_GetItemAtOrDefault_GetsDefault()
        {
            var slowComparer = new SlowComparer();
            var itemList     = new[] { 1, 2, 3, 4, 5 };
            var item         = slowComparer.GetItemAtOrDefault(itemList, 5); // Outside bounds

            Assert.That(item, Is.EqualTo(default(int)), "Item was not default(int) when retrieving from collection using GetItemAtOrDefault.");
        }
Esempio n. 2
0
        public void Method_GetItemAtOrDefault_GetsCorrectItem()
        {
            var slowComparer = new SlowComparer();
            var itemList     = new[] { 1, 2, 3, 4, 5 };
            var item         = slowComparer.GetItemAtOrDefault(itemList, 2); // Points to 3

            Assert.That(item, Is.Not.Null, "Item was null when retrieving from collection using GetItemAtOrDefault.");
            Assert.That(item, Is.EqualTo(3), $"Item was wrong when retrieving from collection using GetItemAtOrDefault - Expected: 3, Actual: {item}");
        }