public void opEquality_KeyStringPair_KeyStringPair() { var obj = new KeyStringPair(); var comparand = new KeyStringPair(); Assert.True(obj == comparand); }
public void opInequality_KeyStringPair_KeyStringPair() { var obj = new KeyStringPair(); var comparand = new KeyStringPair(); Assert.False(obj != comparand); }
public void op_ToString() { var expected = "foo{0}---{0}bar".FormatWith(Environment.NewLine); var actual = new KeyStringPair("foo", "bar").ToString(); Assert.Equal(expected, actual); }
public void op_GetHashCode() { var expected = string.Empty.GetHashCode() ^ string.Empty.GetHashCode(); var actual = new KeyStringPair().GetHashCode(); Assert.Equal(expected, actual); }
public void op_GetObjectData_SerializationInfoNull_StreamingContext() { var context = new StreamingContext(StreamingContextStates.All); ISerializable value = new KeyStringPair(); // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => value.GetObjectData(null, context)); // ReSharper restore AssignNullToNotNullAttribute }
public void indexer_int_set_whenAdd() { var obj = new DataCollection { { "one", "1" } }; Assert.Throws <ArgumentOutOfRangeException>(() => obj[1] = new KeyStringPair("two", "2")); }
public void op_GetObjectData_SerializationInfo_StreamingContext() { var info = new SerializationInfo(typeof(KeyStringPair), new FormatterConverter()); var context = new StreamingContext(StreamingContextStates.All); ISerializable value = new KeyStringPair("foo", "bar"); value.GetObjectData(info, context); Assert.Equal("foo", info.GetString("_key")); Assert.Equal("bar", info.GetString("_value")); }
public void ctor_SerializationInfo_StreamingContext() { var expected = new KeyStringPair("key", "value"); KeyStringPair actual; using (Stream stream = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(stream, new KeyStringPair("key", "value")); stream.Position = 0; actual = (KeyStringPair)formatter.Deserialize(stream); } Assert.Equal(expected, actual); }
public void indexer_int_set() { var obj = new DataCollection { { "one", "1" }, { "nine", "9" } }; obj[1] = new KeyStringPair("two", "2"); Assert.Equal("two", obj[1].Key); Assert.Equal("2", obj[1].Value); }
public void op_Equals_KeyStringPair() { var obj = new KeyStringPair(); Assert.True(new KeyStringPair().Equals(obj)); }
public void op_Equals_objectDiffers() { var obj = new KeyStringPair("key", "value"); Assert.False(new KeyStringPair().Equals(obj)); }
public void op_Equals_object() { object obj = new KeyStringPair(); Assert.True(new KeyStringPair().Equals(obj)); }