public virtual void TestToString() { CharArrayMap <int?> cm = new CharArrayMap <int?>(TEST_VERSION_CURRENT, Collections.SingletonMap <string, int?>("test", 1), false); assertEquals("[test]", cm.Keys.ToString()); assertEquals("[1]", cm.Values.ToString()); assertEquals("[test=1]", cm.EntrySet().ToString()); assertEquals("{test=1}", cm.ToString()); cm.Put("test2", 2); assertTrue(cm.Keys.ToString().Contains(", ")); assertTrue(cm.Values.ToString().Contains(", ")); assertTrue(cm.EntrySet().ToString().Contains(", ")); assertTrue(cm.ToString().Contains(", ")); }
public virtual void TestToString() { CharArrayMap <int?> cm = new CharArrayMap <int?>(TEST_VERSION_CURRENT, Collections.SingletonMap <object, int?>("test", 1), false); assertEquals("[test]", cm.Keys.ToString()); //assertEquals("[1]", cm.Values.ToString()); // TODO: In .NET it would not be possible to make a generic type override the ToString() method to customize it like this without wrapping the result. assertEquals("[test=1]", cm.EntrySet().ToString()); assertEquals("{test=1}", cm.ToString()); cm.Put("test2", 2); assertTrue(cm.Keys.ToString().Contains(", ")); // NOTE: See the note in the KeySet() method as for why this test fails. //assertTrue(cm.Values.ToString().Contains(", ")); // TODO: In .NET it would not be possible to make a generic type override the ToString() method to customize it like this without wrapping the result. assertTrue(cm.EntrySet().ToString().Contains(", ")); assertTrue(cm.ToString().Contains(", ")); }