public void TestCopyToKeyValuePair() { var d = new DynamicDictionary(); d.Add("foo", "bar"); var array = new KeyValuePair <string, object> [d.Count]; d.CopyTo(array, 0); KeyValuePair <string, object> pair = array[0]; Assert.AreEqual("foo", pair.Key); Assert.AreEqual("bar", pair.Value); }
public void Should_copy_to_destination_array_from_given_index_when_copyto_is_invoked(int arrayIndex) { // Given var input = new DynamicDictionary(); input["test"] = 1; var output = new KeyValuePair <string, dynamic> [4]; // When input.CopyTo(output, arrayIndex); // Then output[arrayIndex].Key.ShouldEqual(input.Keys.First()); ((int)output[arrayIndex].Value).ShouldEqual((int)input.Values.First()); }
public void Should_copy_to_destination_array_from_given_index_when_copyto_is_invoked(int arrayIndex) { // Given var input = new DynamicDictionary(); input["test"] = 1; var output = new KeyValuePair<string, dynamic>[4]; // When input.CopyTo(output, arrayIndex); // Then output[arrayIndex].Key.ShouldEqual(input.Keys.First()); ((int)output[arrayIndex].Value).ShouldEqual((int)input.Values.First()); }
public void TestCopyToKeyValuePair() { var d = new DynamicDictionary(); d.Add("foo", "bar"); var array = new KeyValuePair<string, object>[d.Count]; d.CopyTo(array, 0); KeyValuePair<string, object> pair = array[0]; Assert.AreEqual("foo", pair.Key); Assert.AreEqual("bar", pair.Value); }