public void CreateAlbumReview(AlbumReviewDTO albumReviewDto, int albumId) { _albumReviewService.CreateAlbumReview(albumReviewDto, albumId); }
public void CreateReview(AlbumReviewDTO reviewDTO) { albumReviewService.CreateAlbumReview(reviewDTO); }
public void Init() { _interpret1Id = 1; _interpret1 = new InterpretDTO { Name = "System of a down", Language = Language.English, ID = _interpret1Id }; _interpret2Id = 2; _interpret2 = new InterpretDTO { Name = "Linkin Park", Language = Language.English, ID = _interpret2Id }; _interpretService.CreateInterpret(_interpret1); _interpretService.CreateInterpret(_interpret2); _album1Id = 1; _album1 = new AlbumDTO { ID = _album1Id, InterpretId = _interpret1Id, Name = "Toxicity", Year = 2003 }; _album2Id = 2; _album2 = new AlbumDTO { ID = _album2Id, InterpretId = _interpret2Id, Name = "Meteora", Year = 2008 }; _albumService.CreateAlbum(_album1, _interpret1Id); _albumService.CreateAlbum(_album2, _interpret2Id); _albumReview1Id = 1; _albumReview1 = new AlbumReviewDTO { ID = _albumReview1Id, AlbumId = _album1.ID, Note = "Perfect album", Rating = 9 }; _albumReview2Id = 2; _albumReview2 = new AlbumReviewDTO { AlbumId = _album2.ID, Note = "Not bad", Rating = 8, ID = _albumReview2Id }; _albumReviewService.CreateAlbumReview(_albumReview1, _album1Id); _albumReviewService.CreateAlbumReview(_albumReview2, _album2Id); }
private static void TestAlbumReviewService() { List <int> list = new List <int>(); albumReviewService = Container.Resolve <IAlbumReviewService>(); clientService = Container.Resolve <IClientService>(); //Create albumReviewService.CreateAlbumReview(new AlbumReviewDTO { Text = "This disc is a great improvement on an already brilliant EP, keeping the same style with great screams and guitars and improving melodically, lyrically and each song delivering a catchy chorus.", AlbumID = albumID, CreatorID = clientID, }); albumReviewService.CreateAlbumReview(new AlbumReviewDTO { Text = "I remember listening to The Poison, 10 years ago when this style of metalcore was at an incredibly high popularity. I definitely didn’t hate it but still preferred to listen to other bands of even similar genres.", AlbumID = albumID, CreatorID = clientID2, }); //ListAllAlbumReviews var albumReviews = albumReviewService.ListAllAlbumReviews(new AlbumReviewFilter { AlbumID = albumID }, 1); Console.WriteLine(albumReviews.TotalResultCount == 2 ? "AlbumReviewService - TestListAllAlbumReviews - OK" : "AlbumReviewService - TestListAllAlbumReviews - FAIL"); //GetAlbumReviewById var reviews = albumReviewService.ListAllAlbumReviews(new AlbumReviewFilter { CreatorIDs = new List <int> { clientID } }, 1); AlbumReviewDTO albumReview = reviews.ResultsPage.FirstOrDefault(); var testedReview = albumReviewService.GetAlbumReview(albumReview.ID); Console.WriteLine(testedReview.ID == albumReview.ID ? "AlbumReviewService - TestGetAlbumReviewById - OK" : "AlbumReviewService - TestGetAlbumReviewById - FAIL"); //AddAlbumReview reviews = albumReviewService.ListAllAlbumReviews(new AlbumReviewFilter { CreatorIDs = new List <int> { clientID2 } }, 1); AlbumReviewDTO review2 = reviews.ResultsPage.FirstOrDefault(); albumReviewService.AddReview(albumReview); albumReviewService.AddReview(review2); AlbumDTO album = albumService.GetAlbum(albumID); Console.WriteLine(album.ReviewIDs.Contains(review2.ID) ? "AlbumReviewService - TestAddAlbumReview - OK" : "AlbumReviewService - TestAddAlbumReview - FAIL"); //TestAlbumServisGetAllAlbumReviews Console.WriteLine(album.ReviewIDs.Count() == 2 ? "AlbumService - TestAlbumServisGetAllAlbumReviews - OK" : "AlbumService - TestAlbumServisGetAllAlbumReviews - FAIL"); //EditAlbumReview review2.Text = "1010"; albumReviewService.EditAlbumReview(review2); AlbumReviewDTO review2FromDB = albumReviewService.GetAlbumReview(review2.ID); Console.WriteLine(review2FromDB.Text == "1010" ? "AlbumReviewService - TestEditAlbumReview - OK" : "AlbumReviewService - TestEditAlbumReview - FAIL"); //DeleteAlbumReview albumReviewService.DeleteAlbumReview(review2.ID); AlbumReviewDTO venomFromDB = albumReviewService.GetAlbumReview(review2.ID); Console.WriteLine(venomFromDB == null ? "AlbumReviewService - TestDeleteAlbumReview - OK" : "AlbumReviewService - TestDeleteAlbumReview - FAIL"); //GetCreator ClientDTO creator = albumReviewService.GetCreator(albumReview.ID); Console.WriteLine(creator.ID == clientID ? "AlbumReviewService - TestGetCreator - OK" : "AlbumReviewService - TestGetCreator - FAIL"); }