コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Class != null)
         {
             hashCode = hashCode * 59 + Class.GetHashCode();
         }
         if (DefaultParameterValue != null)
         {
             hashCode = hashCode * 59 + DefaultParameterValue.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleTrueValue()
        public virtual void ShouldHandleTrueValue()
        {
            // Given
            string mapString = "{key: true}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("key", true))));
        }
コード例 #3
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
            string mapString = "{key: 2.718281828}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("key", 2.718281828))));
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleMultipleKeys()
        public virtual void ShouldHandleMultipleKeys()
        {
            // Given
            string mapString = "{k1: 2.718281828, k2: 'e'}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("k1", 2.718281828, "k2", "e"))));
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleEscapedDoubleQuotedInValue1()
        public virtual void ShouldHandleEscapedDoubleQuotedInValue1()
        {
            // Given
            string mapString = "{key: \"va\"lue\"}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("key", "va\"lue"))));
        }
コード例 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleSingleQuotedValue()
        public virtual void ShouldHandleSingleQuotedValue()
        {
            // Given
            string mapString = "{key: 'value'}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("key", "value"))));
        }
コード例 #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleKeyWithEscapedDoubleQuote()
        public virtual void ShouldHandleKeyWithEscapedDoubleQuote()
        {
            // Given
            string mapString = "{\"k\"ey\": \"value\"}";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(map("k\"ey", "value"))));
        }
コード例 #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleEmptyMapWithSpaces()
        public virtual void ShouldHandleEmptyMapWithSpaces()
        {
            // Given
            string mapString = " {  }  ";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(emptyMap())));
        }
コード例 #9
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
            string mapString = "null";

            // When
            DefaultParameterValue converted = _converter.apply(mapString);

            // Then
            assertThat(converted, equalTo(ntMap(null)));
        }
コード例 #10
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #11
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #12
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #13
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #14
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #15
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #16
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #17
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #18
0
//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)));
        }
コード例 #19
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #20
0
//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));
        }
コード例 #21
0
ファイル: ListConverterTest.cs プロジェクト: Neo4Net/Neo4Net
//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)));
        }
コード例 #22
0
        /// <summary>
        /// Returns true if StringParameterDefinition instances are equal
        /// </summary>
        /// <param name="other">Instance of StringParameterDefinition to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StringParameterDefinition other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                     ) &&
                 (
                     DefaultParameterValue == other.DefaultParameterValue ||
                     DefaultParameterValue != null &&
                     DefaultParameterValue.Equals(other.DefaultParameterValue)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ));
        }