public void AddRange_adds_multiple__key_value_pairs() { // arrange TagDictionary target; KeyValuePair <string, object>[] expected; target = new TagDictionary(); expected = new[] { new KeyValuePair <string, object>("alpha", (byte)1), new KeyValuePair <string, object>("beta", (short)short.MaxValue), new KeyValuePair <string, object>("gamma", int.MaxValue) }; // act target.AddRange(expected); // assert Assert.AreEqual(expected.Length, target.Count); Assert.IsInstanceOf <TagByte>(target["alpha"]); Assert.AreEqual(1, target["alpha"].GetValue()); Assert.IsInstanceOf <TagShort>(target["beta"]); Assert.AreEqual(short.MaxValue, target["beta"].GetValue()); Assert.IsInstanceOf <TagInt>(target["gamma"]); Assert.AreEqual(int.MaxValue, target["gamma"].GetValue()); }
public void AddRange_adds_tags() { // arrange TagDictionary target; Tag[] expected; target = new TagDictionary(); expected = new Tag[] { new TagByte("alpha", (byte)1), new TagShort("beta", (short)short.MaxValue), new TagInt("gamma", int.MaxValue) }; // act target.AddRange(expected); // assert Assert.AreEqual(expected.Length, target.Count); Assert.AreSame(target["alpha"], expected[0]); Assert.AreSame(target["beta"], expected[1]); Assert.AreSame(target["gamma"], expected[2]); }
public void AddRange_adds_dictionary_contents() { // arrange TagDictionary target; Dictionary <string, object> expected; target = new TagDictionary(); expected = new Dictionary <string, object> { { "alpha", (byte)1 }, { "beta", (short)short.MaxValue }, { "gamma", int.MaxValue } }; // act target.AddRange(expected); // assert Assert.AreEqual(expected.Count, target.Count); Assert.IsInstanceOf <TagByte>(target["alpha"]); Assert.AreEqual(1, target["alpha"].GetValue()); Assert.IsInstanceOf <TagShort>(target["beta"]); Assert.AreEqual(short.MaxValue, target["beta"].GetValue()); Assert.IsInstanceOf <TagInt>(target["gamma"]); Assert.AreEqual(int.MaxValue, target["gamma"].GetValue()); }
public void AddRange_adds_dictionary_contents() { // arrange var target = new TagDictionary(); var expected = new Dictionary <string, object> { { "alpha", (byte)1 }, { "beta", short.MaxValue }, { "gamma", int.MaxValue } }; // act target.AddRange(expected); // assert Assert.Equal(expected.Count, target.Count); Assert.IsType <TagByte>(target["alpha"]); Assert.Equal((byte)1, target["alpha"].GetValue()); Assert.IsType <TagShort>(target["beta"]); Assert.Equal(short.MaxValue, target["beta"].GetValue()); Assert.IsType <TagInt>(target["gamma"]); Assert.Equal(int.MaxValue, target["gamma"].GetValue()); }