public void CanFailWithNullDescription()
 {
     TagTypeRepository repo = new TagTypeRepository();
     Assert.Throws(typeof(SQLiteException), () =>
         repo.Add(new TagType())
     );
 }
        public void CanUpdateTag()
        {
            TagTypeRepository repoTagtypes = new TagTypeRepository();
            TagType tagTypeOriginal = new TagType
            {
                Description = "tag type original"
            };
            TagType tagTypeUpdated = new TagType
            {
                Description = "tag type updated"
            };
            repoTagtypes.Add(tagTypeOriginal);
            repoTagtypes.Add(tagTypeUpdated);

            TagRepository repoTags = new TagRepository();
            Tag tag = new Tag
            {
                Description = "tag",
                TagType = tagTypeOriginal
            };
            repoTags.Add(tag);

            tag.Description = "tag updated";
            tag.TagType = tagTypeUpdated;
            repoTags.Update(tag);

            Assert.AreEqual(tag, repoTags.GetById(tag.Id));
        }
 public void CanAddTagType()
 {
     TagTypeRepository repo = new TagTypeRepository();
     repo.Add(new TagType
     {
         Description = "tag type"
     });
 }
        public void CanGetTagTypeNoReferences()
        {
            TagTypeRepository repo = new TagTypeRepository();
            TagType tagType = new TagType
            {
                Description = "tag type"
            };
            repo.Add(tagType);

            Assert.AreEqual(tagType, repo.GetById(tagType.Id));
        }
        public void CanGetAllTagTypes()
        {
            TagTypeRepository repo = new TagTypeRepository();
            TagType tagType1 = new TagType { Description = "tt1" };
            TagType tagType2 = new TagType { Description = "tt2" };
            repo.Add(tagType1);
            repo.Add(tagType2);

            TagType[] tagTypes = repo.GetAll().ToArray();

            Assert.True(tagTypes.Contains(tagType1));
            Assert.True(tagTypes.Contains(tagType2));
        }
        public void CanDeleteTagType()
        {
            TagTypeRepository repo = new TagTypeRepository();
            TagType tagType = new TagType
            {
                Description = "tag type"
            };
            repo.Add(tagType);

            repo.Delete(tagType.Id);

            Assert.Null(repo.GetById(tagType.Id));
        }
        public void CanUpdateTagType()
        {
            TagTypeRepository repo = new TagTypeRepository();
            TagType tagType = new TagType
            {
                Description = "tag type"
            };
            repo.Add(tagType);

            const string newDescription = "newDescription";
            tagType.Description = newDescription;
            repo.Update(tagType);

            Assert.AreEqual(newDescription, repo.GetById(tagType.Id).Description);
        }