Esempio n. 1
0
        public void Remove_OfAnInstanceInitializedWithReadOnlyList_ThrowsException()
        {
            // Arrange
            var c0 = new NonNullCollection <IUnit>(new IUnit[] {
                MutableUnit.Create("foo"), MutableUnit.Create("bar")
            }.ToList().AsReadOnly());

            // Act
            // Assert
            Assert.That(() => {
                c0.Remove(MutableUnit.Create("baz"));
            }, Throws.InstanceOf <NotSupportedException>());
        }
Esempio n. 2
0
        public void Remove_OfAnInstanceInitializedWithNormalList_DoesNotThrowException()
        {
            // Arrange
            var u0 = MutableUnit.Create("foo");
            var c0 = new NonNullCollection <IUnit>(new IUnit[] {
                u0, MutableUnit.Create("bar")
            }.ToList());

            // Act
            c0.Remove(u0);

            // Assert
            Assert.That(c0.Count, Is.EqualTo(1));
        }
Esempio n. 3
0
        public IniFile RemoveSection
        (
            [NotNull] string name
        )
        {
            CheckKeyName(name);

            foreach (Section section in _sections)
            {
                if (section.Name.SameString(name))
                {
                    _sections.Remove(section);
                    break;
                }
            }

            return(this);
        }
Esempio n. 4
0
            public Section Remove
            (
                [NotNull] string key
            )
            {
                CheckKeyName(key);

                foreach (Line line in _lines)
                {
                    if (line.Key.SameString(key))
                    {
                        _lines.Remove(line);
                        Modified       = true;
                        Owner.Modified = true;
                        break;
                    }
                }

                return(this);
            }