Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void add_throws_if_value_is_null()
        {
            var record = new ConcreteRecordBase();

            Assert.Throws <ArgumentNullException>(() => record.Add(null));
        }
Exemplo n.º 5
0
        public void add_throws_if_read_only()
        {
            var record = new ConcreteRecordBase(true);

            Assert.Throws <NotSupportedException>(() => record.Add("one"));
        }
Exemplo n.º 6
0
 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());
 }
Exemplo n.º 7
0
        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"));
        }
Exemplo n.º 8
0
 public void add_throws_if_value_is_null()
 {
     var record = new ConcreteRecordBase();
     Assert.Throws<ArgumentNullException>(() => record.Add(null));
 }
Exemplo n.º 9
0
 public void add_throws_if_read_only()
 {
     var record = new ConcreteRecordBase(true);
     Assert.Throws<NotSupportedException>(() => record.Add("one"));
 }
Exemplo n.º 10
0
        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);
        }