I came across something that I found counter-intuitive and I was just wondering if this was a bug or is the desired functionality...
public void TestMethod1()
var myList = new List<string>();
myList.Should().OnlyContain(x => x == "bar"); //This passes
myList.Should().Contain(x => x == "bar"); //This fails
myList.Should().OnlyContain(x => x == "bar"); //This fails
To me it seems like OnlyContain should verify that "bar" is in the collection and if the collection is empty it should through an error.
Can someone describe a scenario where it would be acceptable for OnlyContain to not throw an error when the collection is empty?