コード例 #1
0
        public void Add_ShouldThrowArgumentNullExceptionWhenNullTagProvided()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            tagsService.Add(null);
        }
コード例 #2
0
        public void Delete_ShouldReturnProperValueWhenTagIdDoesNotExist()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            var deletedTagId = tagsService.DeleteTagById(GlobalConstants.DefaultTagIdForTesting);

            Assert.AreEqual(-1, deletedTagId);
        }
コード例 #3
0
        public void GetById_ShouldReturnProperAmountOfTags()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            var newTag = new Tag();
            var tagId = newTag.Id;

            tagsService.Add(newTag);
            var foundTags = tagsService.GetById(tagId);

            Assert.AreEqual(1, foundTags.Count());
        }
コード例 #4
0
        public void Delete_ShouldReturnProperDeletedTagId()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            var newTag = new Tag();
            var tagId = newTag.Id;

            tagsService.Add(newTag);
            tagsService.DeleteTagById(tagId);
            var foundTags = tagsService.GetById(tagId);

            Assert.AreEqual(0, foundTags.Count());
        }
コード例 #5
0
        public void GetById_ShouldReturnZeroWhenSuchTagIdIsNotFound()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            var foundTags = tagsService.GetById(GlobalConstants.DefaultTagIdForTesting);

            Assert.AreEqual(0, foundTags.Count());
        }