public async Task GetTagSuggestions() { void AddTagUsages(Song[] songs, string[] tagNames) { var(tags, tagUsages, tagVotes) = CreateEntry.TagUsages(songs, tagNames, _user, new SongTagUsageFactory(_repository.CreateContext(), _song)); _repository.Save(tags); _repository.Save(tagUsages); _repository.Save(tagVotes); } AddTagUsages(new[] { _song, _song2 }, new[] { "vocarock", "techno" }); _repository.Save(_album.AddSong(_song, 1, 1), _album.AddSong(_song2, 2, 1)); var result = await _queries.GetTagSuggestions(_album.Id); result.Length.Should().Be(2, "Number of tag suggestions"); result.Any(r => r.Tag.Name == "vocarock").Should().BeTrue("First tag was returned"); }
public void GetTagSuggestions() { void AddTagUsages(Song[] songs, string[] tagNames) { var(tags, tagUsages, tagVotes) = CreateEntry.TagUsages(songs, tagNames, user, new SongTagUsageFactory(repository.CreateContext(), song)); repository.Save(tags); repository.Save(tagUsages); repository.Save(tagVotes); } AddTagUsages(new [] { song, song2 }, new[] { "vocarock", "techno" }); repository.Save(album.AddSong(song, 1, 1), album.AddSong(song2, 2, 1)); var result = queries.GetTagSuggestions(album.Id); Assert.AreEqual(2, result.Length, "Number of tag suggestions"); Assert.IsTrue(result.Any(r => r.Tag.Name == "vocarock"), "First tag was returned"); }
public IEnumerable <TagUsageForApiContract> GetTagSuggestions(int id) { return(queries.GetTagSuggestions(id)); }
public Task <TagUsageForApiContract[]> GetTagSuggestions(int id) { return(queries.GetTagSuggestions(id)); }
public Task <TagUsageForApiContract[]> GetTagSuggestions(int id) => _queries.GetTagSuggestions(id);