-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from davewalker5/MC-150-Genre-Based-Browsing
MC-150 Genre based catalogue browsing
- Loading branch information
Showing
37 changed files
with
432 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM mcr.microsoft.com/dotnet/core/aspnet:latest | ||
COPY musiccatalogue.api-1.17.0.0 /opt/musiccatalogue.api-1.17.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.17.0.0/bin | ||
COPY musiccatalogue.api-1.18.0.0 /opt/musiccatalogue.api-1.18.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.18.0.0/bin | ||
ENTRYPOINT [ "./MusicCatalogue.Api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM node:20-alpine | ||
COPY musiccatalogue.ui-1.17.0.0 /opt/musiccatalogue.ui-1.17.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.17.0.0 | ||
COPY musiccatalogue.ui-1.18.0.0 /opt/musiccatalogue.ui-1.18.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.18.0.0 | ||
RUN npm install | ||
RUN npm run build | ||
ENTRYPOINT [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
|
||
namespace MusicCatalogue.Entities.Search | ||
{ | ||
[ExcludeFromCodeCoverage] | ||
public class GenreSearchCriteria | ||
{ | ||
public bool? WishList { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using MusicCatalogue.Data; | ||
using MusicCatalogue.Entities.Interfaces; | ||
using MusicCatalogue.Entities.Search; | ||
using MusicCatalogue.Logic.Factory; | ||
|
||
namespace MusicCatalogue.Tests | ||
{ | ||
[TestClass] | ||
public class GenreSearchManagerTest | ||
{ | ||
private const string JazzGenre = "Jazz"; | ||
private const string PopGenre = "Pop"; | ||
|
||
private IMusicCatalogueFactory? _factory; | ||
private int _jazzGenreId; | ||
private int _popGenreId; | ||
private int _jazzArtistId; | ||
private int _popArtistId; | ||
|
||
[TestInitialize] | ||
public void TestInitialize() | ||
{ | ||
MusicCatalogueDbContext context = MusicCatalogueDbContextFactory.CreateInMemoryDbContext(); | ||
_factory = new MusicCatalogueFactory(context); | ||
|
||
// Add the genres | ||
_jazzGenreId = Task.Run(() => _factory.Genres.AddAsync("Jazz")).Result.Id; | ||
_popGenreId = Task.Run(() => _factory.Genres.AddAsync("Pop")).Result.Id; | ||
|
||
// Add the artists | ||
_jazzArtistId = Task.Run(() => _factory.Artists.AddAsync("Diana Krall")).Result.Id; | ||
_popArtistId = Task.Run(() => _factory.Artists.AddAsync("Katie Melua")).Result.Id; | ||
} | ||
|
||
[TestMethod] | ||
public async Task SearchForAllGenresTest() | ||
{ | ||
// Add the albums, one on the wishlist and one not | ||
Task.Run(() => _factory!.Albums.AddAsync(_jazzArtistId, _jazzGenreId, "Live In Paris", 2002, null, false, null, null, null)).Wait(); | ||
Task.Run(() => _factory!.Albums.AddAsync(_popArtistId, _popGenreId, "Album No. 8", 2020, null, true, null, null, null)).Wait(); | ||
|
||
var genres = await _factory!.Search.GenreSearchAsync(new GenreSearchCriteria()); | ||
Assert.IsNotNull(genres); | ||
Assert.AreEqual(2, genres.Count); | ||
} | ||
|
||
[TestMethod] | ||
public async Task SearchMainCatalogueGenresTest() | ||
{ | ||
// Add the albums, one on the wishlist and one not | ||
Task.Run(() => _factory!.Albums.AddAsync(_jazzArtistId, _jazzGenreId, "Live In Paris", 2002, null, false, null, null, null)).Wait(); | ||
Task.Run(() => _factory!.Albums.AddAsync(_popArtistId, _popGenreId, "Album No. 8", 2020, null, true, null, null, null)).Wait(); | ||
|
||
var criteria = new GenreSearchCriteria { WishList = false }; | ||
var genres = await _factory!.Search.GenreSearchAsync(criteria); | ||
Assert.IsNotNull(genres); | ||
Assert.AreEqual(1, genres.Count); | ||
Assert.AreEqual(JazzGenre, genres[0].Name); | ||
} | ||
|
||
[TestMethod] | ||
public async Task SearchWishlistGenresTest() | ||
{ | ||
// Add the albums, one on the wishlist and one not | ||
Task.Run(() => _factory!.Albums.AddAsync(_jazzArtistId, _jazzGenreId, "Live In Paris", 2002, null, false, null, null, null)).Wait(); | ||
Task.Run(() => _factory!.Albums.AddAsync(_popArtistId, _popGenreId, "Album No. 8", 2020, null, true, null, null, null)).Wait(); | ||
|
||
var criteria = new GenreSearchCriteria { WishList = true }; | ||
var genres = await _factory!.Search.GenreSearchAsync(criteria); | ||
Assert.IsNotNull(genres); | ||
Assert.AreEqual(1, genres.Count); | ||
Assert.AreEqual(PopGenre, genres[0].Name); | ||
} | ||
|
||
[TestMethod] | ||
public async Task NoMatchesTest() | ||
{ | ||
var genres = await _factory!.Search.GenreSearchAsync(new GenreSearchCriteria()); | ||
Assert.IsNull(genres); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.