Esempio n. 1
0
        public void Add_ShouldThrowArgumentNullExceptionWhenNullTagProvided()
        {
            var data        = new FakeGalleryData();
            var tagsService = new TagsService(data);

            tagsService.Add(null);
        }
        public void Add_ShouldThrowArgumentNullExceptionWhenNullTagProvided()
        {
            var data = new FakeGalleryData();
            var tagsService = new TagsService(data);

            tagsService.Add(null);
        }
Esempio n. 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());
        }
Esempio n. 4
0
        private static void AddTag(RealEstatesDbContext context)
        {
            Console.WriteLine("Tag name:");
            string tagName = Console.ReadLine();

            Console.WriteLine("Importance (optional):");
            int importance = int.Parse(Console.ReadLine());

            IPropertiesService propertiesService = new PropertiesService(context);
            ITagsService       tagsService       = new TagsService(context, propertiesService);

            tagsService.Add(tagName, importance);
        }
Esempio n. 5
0
        private static void AddTag(ApplicationDbContext db)
        {
            Console.WriteLine("Tag name:");
            string tagName = Console.ReadLine();

            Console.WriteLine("Importance:");
            int tagImportance = int.Parse(Console.ReadLine());

            IPropertiesService propertiesService = new PropertiesService(db);
            ITagsService       tagsService       = new TagsService(db, propertiesService);

            tagsService.Add(tagName, tagImportance);
        }
        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());
        }
Esempio n. 7
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());
        }
        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());
        }
Esempio n. 9
0
        private static void AddTag(RealEstatesDbContext context)
        {
            Console.Write("Tag name:");
            var name = Console.ReadLine();

            Console.Write("Importance (optional):");
            var parsed = int.TryParse(Console.ReadLine(), out var importance);

            var propertyService = new PropertiesService(context);
            var service         = new TagsService(context, propertyService);

            var tagImportance = parsed ? importance : (int?)null;

            service.Add(name, tagImportance);
        }