[Test] public void FindReturnsItemMatchCriteriaOtherwiseDefaultValue() { var sut = new CopyOnWriteList <T>(Samples); Assert.That(sut.Find(b => b.Equals(TestData <T> .M1)), Is.EqualTo(default(T))); var head = TestData <T> .Zero; Assert.That(sut.Find(b => b.Equals(head)), Is.EqualTo(head)); var tail = TestData <T> .MakeData(SampleSize - 1); Assert.That(sut.Find(b => b.Equals(tail)), Is.EqualTo(tail)); var half = TestData <T> .MakeData(SampleSize / 2); Assert.That(sut.Find(b => b.Equals(half)), Is.EqualTo(half)); }
[Test] public void FindChokesOnNullMatchCriteria() { var sut = new CopyOnWriteList <T>(); Assert.Catch <ArgumentNullException>(() => sut.Find(null)); }