public void add_adds_specified_value() { var record = new ConcreteRecordBase(); record.Add("one"); Assert.Equal(1, record.Count); Assert.True(record.Contains("one")); record.Add("two"); Assert.Equal(2, record.Count); Assert.True(record.Contains("two")); }
public void to_string_returns_a_useful_debug_representation_of_the_record() { var separator = (char)0x2022; var record = new ConcreteRecordBase("value1", "value2", "value3", "value4"); Assert.Equal(string.Format("value1{0}value2{0}value3{0}value4{0}", separator), record.ToString()); record[1] += " "; Assert.Equal(string.Format("value1{0}value2 {0}value3{0}value4{0}", separator), record.ToString()); record.Add("a new value"); Assert.Equal(string.Format("value1{0}value2 {0}value3{0}value4{0}a new value{0}", separator), record.ToString()); }
public void count_returns_number_of_values() { var record1 = new ConcreteRecordBase("one", "two"); Assert.Equal(2, record1.Count); var record2 = new ConcreteRecordBase(new string[] { "one", "two" }.ToList()); record2.Add("three"); Assert.Equal(3, record2.Count); }
public void add_throws_if_value_is_null() { var record = new ConcreteRecordBase(); Assert.Throws <ArgumentNullException>(() => record.Add(null)); }
public void add_throws_if_read_only() { var record = new ConcreteRecordBase(true); Assert.Throws <NotSupportedException>(() => record.Add("one")); }
public void to_string_returns_a_useful_debug_representation_of_the_record() { var separator = (char)0x2022; var record = new ConcreteRecordBase("value1", "value2", "value3", "value4"); Assert.Equal(string.Format("value1{0}value2{0}value3{0}value4{0}", separator), record.ToString()); record[1] += " "; Assert.Equal(string.Format("value1{0}value2 {0}value3{0}value4{0}", separator), record.ToString()); record.Add("a new value"); Assert.Equal(string.Format("value1{0}value2 {0}value3{0}value4{0}a new value{0}", separator), record.ToString()); }
public void add_adds_specified_value() { var record = new ConcreteRecordBase(); record.Add("one"); Assert.Equal(1, record.Count); Assert.True(record.Contains("one")); record.Add("two"); Assert.Equal(2, record.Count); Assert.True(record.Contains("two")); }
public void add_throws_if_value_is_null() { var record = new ConcreteRecordBase(); Assert.Throws<ArgumentNullException>(() => record.Add(null)); }
public void add_throws_if_read_only() { var record = new ConcreteRecordBase(true); Assert.Throws<NotSupportedException>(() => record.Add("one")); }
public void count_returns_number_of_values() { var record1 = new ConcreteRecordBase("one", "two"); Assert.Equal(2, record1.Count); var record2 = new ConcreteRecordBase(new string[] { "one", "two" }.ToList()); record2.Add("three"); Assert.Equal(3, record2.Count); }