public void AddReview(AlbumReviewDTO reviewDTO) { albumReviewService.AddReview(reviewDTO); }
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"); }