Пример #1
0
        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));
        }
Пример #2
0
        public void CanFailWithNullDescription()
        {
            TagTypeRepository repo = new TagTypeRepository();

            Assert.Throws(typeof(SQLiteException), () =>
                          repo.Add(new TagType())
                          );
        }
Пример #3
0
        public void CanAddTagType()
        {
            TagTypeRepository repo = new TagTypeRepository();

            repo.Add(new TagType
            {
                Description = "tag type"
            });
        }
Пример #4
0
        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));
        }
Пример #5
0
        public void CanGetTagTypeNoReferences()
        {
            TagTypeRepository repo    = new TagTypeRepository();
            TagType           tagType = new TagType
            {
                Description = "tag type"
            };

            repo.Add(tagType);

            Assert.AreEqual(tagType, repo.GetById(tagType.Id));
        }
Пример #6
0
        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));
        }
Пример #7
0
        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);
        }