public void Ensure() { var sut = new Dictionary<string, int>(); var called = 0; Assert.Equal( 1, sut.Ensure( "Key", x => ++called ) ); Assert.Equal( 1, sut.Ensure( "Key", x => ++called ) ); }
public void Ensure() { var dict = new Dictionary<string, int>(); dict.Ensure("a", 1); Assert.AreEqual("([a,1])", dict.Print()); dict.Ensure("a", 2); Assert.AreEqual("([a,2])", dict.Print()); }
public void Print() { var d = new Dictionary<string, object>(); d.Ensure("foo", 1); d.Ensure("bar", true); // Note - Print should alphabetize the keys Assert.AreEqual("([bar,True],[foo,1])", d.Print()); }