public void Remove_string_ReturnsFalseForEmptyCollection()
        {
            TagsCollection target  = new TagsCollection();
            bool           removed = target.Remove("key");

            Assert.False(removed);
        }
        public bool DeleteTag(string tagName)
        {
            var originalCount = TagsCollection.Count;

            TagsCollection.Remove(tagName);
            return((TagsCollection.Count == (originalCount - 1)) ? true : false);
        }
        public void Remove_Tag_RemovesItemAndReturnsTrueIfCollectionContainsTag()
        {
            TagsCollection target = new TagsCollection(_tags);

            Assert.True(target.Remove(_tags[0]));
            this.CompareCollections(_tags.Skip(1), target);
        }
        public void Remove_Tag_ReturnsFalseForEmptyCollection()
        {
            TagsCollection target  = new TagsCollection();
            bool           removed = target.Remove(new Tag("key", "value"));

            Assert.False(removed);
        }
        public void Remove_string_DoNothingAndReturnsFalseIfCollectionDoesNotContainTag()
        {
            Tag[] tags = new Tag[] { new Tag("test-key-1", "test-value"), new Tag("test-key-2", "test-value") };

            TagsCollection target = new TagsCollection(tags);

            Assert.False(target.Remove("non-existing-tag"));
        }
        public void Remove_Tag_DoNothingAndReturnsFalseIfCollectionDoesNotContainTag()
        {
            TagsCollection target = new TagsCollection(_tags);

            Tag testTag = new Tag("other-key", "other-value");

            Assert.False(target.Remove(testTag));
            this.CompareCollections(_tags, target);
        }
        public void Remove_string_RemovesItemAndReturnsTrueIfCollectionContainsTag()
        {
            Tag[] tags = new Tag[] { new Tag("test-key-1", "test-value"), new Tag("test-key-2", "test-value") };

            TagsCollection target = new TagsCollection(tags);

            Assert.True(target.Remove(tags[1].Key));
            Assert.Equal(1, target.Count);
            Assert.Contains(tags[0], target);
        }
Beispiel #8
0
        /// <summary>
        /// Delete a tag and its contents from storage and the local collection
        /// </summary>
        /// <param name="tagToDelete"></param>
        public static void DeleteTag(Tag tagToDelete)
        {
            // Delete all the TaggedAlbum entries from the Tag
            tagToDelete.DeleteTaggedAlbums(tagToDelete.TaggedAlbums.ToList());

            // Delete the Tag itself. No need to wait for this
            DbAccess.DeleteAsync(tagToDelete);

            // And locally
            TagsCollection.Remove(tagToDelete);

            new TagDeletedMessage()
            {
                DeletedTag = tagToDelete
            }.Send();
        }
        public void Remove_Tag_ReturnsFalseForEmptyCollection()
        {
            TagsCollection target = new TagsCollection();
            bool removed = target.Remove(new Tag("key", "value"));

            Assert.False(removed);
        }
        public void Remove_Tag_RemovesItemAndReturnsTrueIfCollectionContainsTag()
        {
            TagsCollection target = new TagsCollection(_tags);

            Assert.True(target.Remove(_tags[0]));
            this.CompareCollections(_tags.Skip(1), target);
        }
        public void Remove_Tag_DoNothingAndReturnsFalseIfCollectionDoesNotContainTag()
        {
            TagsCollection target = new TagsCollection(_tags);

            Tag testTag = new Tag("other-key", "other-value");
            Assert.False(target.Remove(testTag));
            this.CompareCollections(_tags, target);
        }
        public void Remove_string_ReturnsFalseForEmptyCollection()
        {
            TagsCollection target = new TagsCollection();
            bool removed = target.Remove("key");

            Assert.False(removed);
        }
        public void Remove_string_RemovesItemAndReturnsTrueIfCollectionContainsTag()
        {
            Tag[] tags = new Tag[] { new Tag("test-key-1", "test-value"), new Tag("test-key-2", "test-value") };

            TagsCollection target = new TagsCollection(tags);

            Assert.True(target.Remove(tags[1].Key));
            Assert.Equal(1, target.Count);
            Assert.Contains(tags[0], target);
        }
        public void Remove_string_DoNothingAndReturnsFalseIfCollectionDoesNotContainTag()
        {
            Tag[] tags = new Tag[] { new Tag("test-key-1", "test-value"), new Tag("test-key-2", "test-value") };

            TagsCollection target = new TagsCollection(tags);

            Assert.False(target.Remove("non-existing-tag"));
        }