public void Add_ShouldThrowArgumentNullExceptionWhenNullTagProvided() { var data = new FakeGalleryData(); var tagsService = new TagsService(data); tagsService.Add(null); }
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()); }
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); }
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 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()); }
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); }