public void Remove_FromReadOnly()
        {
            ushort[] source        = GetArray();
            var      col           = new ModbusDataCollection <ushort>(new ReadOnlyCollection <ushort>(source));
            int      expectedCount = source.Length;

            Assert.False((bool)col.Remove(GetNonExistentElement()));
            Assert.True((bool)col.Remove(source[3]));

            Assert.Equal(expectedCount, col.Count);
        }
Ejemplo n.º 2
0
        public void Remove_FromReadOnly()
        {
            bool[] source        = { false, false, false, true, false, false };
            var    col           = new ModbusDataCollection <bool>(new ReadOnlyCollection <bool>(source));
            int    expectedCount = source.Length;

            Assert.True(col.Remove(source[3]));

            Assert.Equal(expectedCount, col.Count);
        }
Ejemplo n.º 3
0
        public void ZeroElementUsingItem_Negative()
        {
            var source = GetArray();
            var col    = new ModbusDataCollection <TData>(source);

            Assert.Throws <ArgumentOutOfRangeException>(() => col[0] = source[3]);
            Assert.Throws <ArgumentOutOfRangeException>(() => col.Insert(0, source[3]));
            Assert.Throws <ArgumentOutOfRangeException>(() => col.RemoveAt(0));

            // Remove forst zero/false
            Assert.Throws <ArgumentOutOfRangeException>(() => col.Remove(default(TData)));
        }
Ejemplo n.º 4
0
        public void Remove()
        {
            List <TData> source        = GetList();
            var          col           = new ModbusDataCollection <TData>(source);
            int          expectedCount = source.Count - 1;

            Assert.True((bool)col.Remove(source[3]));

            Assert.Equal(expectedCount, col.Count);
            Assert.Equal(expectedCount, source.Count);
            Assert.Equal(source, col);
        }
Ejemplo n.º 5
0
        public void RemoveZeroElement()
        {
            ModbusDataCollection <bool> col = new ModbusDataCollection <bool>();

            col.Remove(default(bool));
        }
 public void RemoveZeroElement()
 {
     ModbusDataCollection<bool> col = new ModbusDataCollection<bool>();
     col.Remove(default(bool));
 }
        public void RemoveZeroElement()
        {
            ModbusDataCollection <bool> col = new ModbusDataCollection <bool>();

            Assert.Throws <ArgumentOutOfRangeException>(() => col.Remove(default(bool)));
        }
 public void RemoveZeroElement()
 {
     ModbusDataCollection<bool> col = new ModbusDataCollection<bool>();
     Assert.Throws<ArgumentOutOfRangeException>(() => col.Remove(default(bool)));
 }