Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleNullString()
        public virtual void ShouldHandleNullString()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(string), NTString);
            string        listString = "null";

            // When
            DefaultParameterValue converted = converter.Apply(listString);

            // Then
            assertThat(converted, equalTo(ntList(null, NTString)));
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleEmptyListWithSpaces()
        public virtual void ShouldHandleEmptyListWithSpaces()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(string), NTString);
            string        listString = " [  ]   ";

            // When
            DefaultParameterValue converted = converter.Apply(listString);

            // Then
            assertThat(converted, equalTo(ntList(emptyList(), NTString)));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldPassOnValidMixedTyoes()
        public virtual void ShouldPassOnValidMixedTyoes()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(object), NTAny);
            string        listString = "[1337, 'forty-two']";

            // When
            DefaultParameterValue value = converter.Apply(listString);

            // Then
            assertThat(value, equalTo(ntList(asList(1337L, "forty-two"), NTAny)));
        }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleBooleanValues()
        public virtual void ShouldHandleBooleanValues()
        {
            // Given
            ListConverter converter = new ListConverter(typeof(Boolean), NTBoolean);
            string        mapString = "[false, true]";

            // When
            DefaultParameterValue converted = converter.Apply(mapString);

            // Then
            assertThat(converted, equalTo(ntList(asList(false, true), NTBoolean)));
        }
Exemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleNullValue()
        public virtual void ShouldHandleNullValue()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(Double), NTFloat);
            string        listString = "[null]";

            // When
            DefaultParameterValue converted = converter.Apply(listString);

            // Then
            assertThat(converted, equalTo(ntList(singletonList(null), NTFloat)));
        }
Exemplo n.º 6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleFloatValue()
        public virtual void ShouldHandleFloatValue()
        {
            // Given
            ListConverter converter = new ListConverter(typeof(Double), NTFloat);
            string        listSting = "[2.718281828, 3.14]";

            // When
            DefaultParameterValue converted = converter.Apply(listSting);

            // Then
            assertThat(converted, equalTo(ntList(asList(2.718281828, 3.14), NTFloat)));
        }
Exemplo n.º 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleIntegerValue()
        public virtual void ShouldHandleIntegerValue()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(Long), NTInteger);
            string        listString = "[1337, 42]";

            // When
            DefaultParameterValue converted = converter.Apply(listString);

            // Then
            assertThat(converted, equalTo(ntList(asList(1337L, 42L), NTInteger)));
        }
Exemplo n.º 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleDoubleQuotedValue()
        public virtual void ShouldHandleDoubleQuotedValue()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(string), NTString);
            string        listString = "[\"foo\", \"bar\"]";

            // When
            DefaultParameterValue converted = converter.Apply(listString);

            // Then
            assertThat(converted, equalTo(ntList(asList("foo", "bar"), NTString)));
        }
Exemplo n.º 9
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFailOnInvalidMixedTyoes()
        public virtual void ShouldFailOnInvalidMixedTyoes()
        {
            // Given
            ListConverter converter  = new ListConverter(typeof(Long), NTInteger);
            string        listString = "[1337, 'forty-two']";

            // Expect
            Exception.expect(typeof(System.ArgumentException));
            Exception.expectMessage("Expects a list of Long but got a list of String");

            // When
            converter.Apply(listString);
        }
Exemplo n.º 10
0
//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)));
        }
Exemplo n.º 11
0
//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)));
        }