//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Test public void shouldHandleMapsWithLists() public virtual void ShouldHandleMapsWithLists() { // Given string mapString = "{k1: [1337, 42]}"; // When DefaultParameterValue converted = _converter.apply(mapString); // Then IDictionary <string, object> map1 = (IDictionary <string, object>)converted.Value(); assertThat(map1["k1"], equalTo(asList(1337L, 42L))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Test public void shouldHandleListsOfMaps() public virtual void ShouldHandleListsOfMaps() { // Given ListConverter converter = new ListConverter(typeof(System.Collections.IDictionary), NTMap); string mapString = "[{k1: 42}, {k1: 1337}]"; // When DefaultParameterValue converted = converter.Apply(mapString); // Then IList <object> list = (IList <object>)converted.Value(); assertThat(list[0], equalTo(map("k1", 42L))); assertThat(list[1], equalTo(map("k1", 1337L))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Test public void shouldHandleNestedMaps() public virtual void ShouldHandleNestedMaps() { // Given string mapString = "{k1: 1337, k2: { k1 : 1337, k2: {k1: 1337}}}"; // When DefaultParameterValue converted = _converter.apply(mapString); // Then IDictionary <string, object> map1 = (IDictionary <string, object>)converted.Value(); IDictionary <string, object> map2 = (IDictionary <string, object>)map1["k2"]; IDictionary <string, object> map3 = (IDictionary <string, object>)map2["k2"]; assertThat(map1["k1"], equalTo(1337L)); assertThat(map2["k1"], equalTo(1337L)); assertThat(map3["k1"], equalTo(1337L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Test public void shouldHandleNestedLists() public virtual void ShouldHandleNestedLists() { // Given ParameterizedType type = mock(typeof(ParameterizedType)); when(type.ActualTypeArguments).thenReturn(new Type[] { typeof(object) }); ListConverter converter = new ListConverter(type, NTList(NTAny)); string mapString = "[42, [42, 1337]]"; // When DefaultParameterValue converted = converter.Apply(mapString); // Then IList <object> list = (IList <object>)converted.Value(); assertThat(list[0], equalTo(42L)); assertThat(list[1], equalTo(asList(42L, 1337L))); }