public void OSMTagsCollectionAddThrowsExceprionIfTagWithTheSameKeyIsAlreadyPresent()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            string key = "test-key";
            OSMTag toAdd = new OSMTag(key, "test-value");
            target.Add(toAdd);

            OSMTag anotherTag = new OSMTag(key, "some-value");

            Assert.Throws<ArgumentException>(delegate { target.Add(anotherTag); });
        }
        public void OSMTagsCollectionAddAddsOSMTag()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            OSMTag toAdd = new OSMTag("test-key", "test-value");

            Assert.Equal(0, target.Count);

            target.Add(toAdd);
            Assert.Equal(1, target.Count);
        }
        public void OSMTagsCollectionImplementsIEnumerable()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            OSMTag first = new OSMTag("test-key", "test-value");
            OSMTag second = new OSMTag("test-key-2", "another-test-value");
            target.Add(first);
            target.Add(second);

            int counter = 0;
            foreach (var tag in target) {
                counter++;
            }

            Assert.Equal(2, counter);
        }
        public void OSMTagsCollectionHasTagReturnsCorrectValues()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            string key = "test-key";
            OSMTag toAdd = new OSMTag(key, "test-value");
            target.Add(toAdd);

            Assert.True(target.ContainsTag(key));
            Assert.False(target.ContainsTag("another-key"));
        }
        public void OSMTagsCollectionStringIndexerThrowsExceptionIfKeyIsNotPresent()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            OSMTag toAdd = new OSMTag("test-key", "test-value");
            target.Add(toAdd);

            Assert.Throws<ArgumentException>(delegate { OSMTag tag = target["another-key"]; });
        }
        public void OSMTagsCollectionStringIndexerReturnsCorrectOSMTagByKey()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            string key = "test-key";
            OSMTag toAdd = new OSMTag(key, "test-value");
            target.Add(toAdd);

            Assert.Same(toAdd, target[key]);
        }
        public void OSMTagsCollectionRemoveCanRemoveTagFromCollection()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            OSMTag tag = new OSMTag("test-key", "test-value");

            target.Add(tag);

            Assert.True(target.Remove(tag));
            Assert.Equal(0, target.Count);
        }
        public void OSMTagsCollectionRemoveAllRemovesAllTagsFromTheCollection()
        {
            OSMTagsCollection target = new OSMTagsCollection();
            OSMTag first = new OSMTag("test-key", "test-value");
            OSMTag second = new OSMTag("test-key-2", "another-test-value");
            target.Add(first);
            target.Add(second);

            target.RemoveAll();

            Assert.Equal(0, target.Count);
        }