Ejemplo n.º 1
0
		public void genericKey_value_ctor_null_arg_set_value()
		{
			String expected = null;

			Key<String> key = new Key<String>( expected );

			Assert.AreEqual<String>( expected, key.Value );
		}
Ejemplo n.º 2
0
		public void genericKey_value_ctor_set_value()
		{
			Int32 expected = 10;

			Key<Int32> key = new Key<Int32>( expected );

			Assert.AreEqual<Int32>( expected, key.Value );
		}
Ejemplo n.º 3
0
		public void genericKey_ctor_default_to_value_with_valueType()
		{
			Int32 expected = 0;

			Key<Int32> key = new Key<Int32>();

			Assert.AreEqual<Int32>( expected, key.Value );
		}
Ejemplo n.º 4
0
		public void genericKey_ctor_default_to_null_with_reference()
		{
			String expected = null;

			Key<String> key = new Key<String>();

			Assert.AreEqual<String>( expected, key.Value );
		}
Ejemplo n.º 5
0
		public void genericKey_toString_with_null_value()
		{
			String expected = "";

			Key<String> key = new Key<String>( null );
			String actual = key.ToString();

			Assert.AreEqual<String>( expected, actual );
		}
Ejemplo n.º 6
0
		public void genericKey_toString_with_non_null_value()
		{
			Int32 value = 12;
			String expected = value.ToString();

			Key<Int32> key = new Key<Int32>( value );
			String actual = key.ToString();

			Assert.AreEqual<String>( expected, actual );
		}
Ejemplo n.º 7
0
		public void genericKey_implicit_operator_from_key_to_value()
		{
			Int32 expected = 12;
			Key<Int32> key = new Key<int>( expected );
			Int32 value = key;

			Assert.AreEqual<Int32>( expected, value );
		}
Ejemplo n.º 8
0
		public void genericKey_with_null_value_compareTo_other_genericKey_reference_with_null_value_should_be_zero()
		{
			var target = new Key<String>( null );
			var key = new Key<String>( null );

			Int32 actual = target.CompareTo( key );

			actual.Should().Be.EqualTo( 0 );
		}
Ejemplo n.º 9
0
		public void genericKey_compareTo_null_reference_should_be_one()
		{
			var target = new Key<String>( "Foo" );

			Int32 actual = target.CompareTo( null );

			actual.Should().Be.EqualTo( 1 );
		}
Ejemplo n.º 10
0
		public void genericKey_compareTo_other_object_reference_should_be_zero()
		{
			Key<String> target = new Key<String>( "Foo" );
			object key = new Key<String>( "Foo" );

			Int32 actual = target.CompareTo( key );

			actual.Should().Be.EqualTo( 0 );
		}
Ejemplo n.º 11
0
		public void genericKey_equals_other_object_reference_should_be_true()
		{
			Key<String> target = new Key<String>( "Foo" );
			object key = new Key<String>( "Foo" );

			Boolean actual = target.Equals( key );

			actual.Should().Be.True();
		}
Ejemplo n.º 12
0
		public void genericKey_disequality_operator_same_reference_should_be_false()
		{
			Key<String> target = new Key<string>( "Foo" );
			Boolean actual = target != target;

			actual.Should().Be.False();
		}
Ejemplo n.º 13
0
		public void genericKey_equals_same_reference_should_be_true()
		{
			Key<String> target = new Key<string>( "Foo" );
			Boolean actual = target.Equals( target );

			actual.Should().Be.True();
		}
Ejemplo n.º 14
0
		public void genericKey_static_equals_nullValue_to_nullValue_not_equal()
		{
			Boolean expected = false;

			Key<String> key1 = new Key<string>( null );
			Key<String> key2 = new Key<string>( null );

			Boolean actual = key1 != key2;

			Assert.AreEqual<Boolean>( expected, actual );
		}
Ejemplo n.º 15
0
		public void genericKey_with_null_value_multiple_calls_getHashCode_same_value()
		{
			Key<String> key1 = new Key<string>( null );

			Int32 expected = key1.GetHashCode();

			for( Int32 i = 0; i < 10; i++ )
			{
				Int32 actual = key1.GetHashCode();
				Assert.AreEqual<Int32>( expected, actual );
			}
		}