public async Task RemoveReportAsync_RemoveReport_ReportRemoved(int userId1, int userId2, string report) { IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IFriendRequestListRepo friendRequestListRepo = new FriendRequestListRepo(dataGateway, connectionString); IFriendBlockListRepo friendBlockListRepo = new FriendBlockListRepo(dataGateway, connectionString); IFriendListRepo friendListRepo = new FriendListRepo(dataGateway, connectionString); IUserReportsRepo userReportsRepo = new UserReportsRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserProfileRepository userProfileRepository = new UserProfileRepository(dataGateway, connectionString); IUserProfileService userProfileService = new UserProfileService(userProfileRepository); IUserAccountService userAccountService = new UserAccountService(userAccountRepository); IValidationService validationService = new ValidationService(userAccountService, userProfileService); IUserInteractionService userInteractionService = new UserInteractionService(friendBlockListRepo, friendListRepo, friendRequestListRepo, userReportsRepo, validationService); UserReportsModel model = new UserReportsModel(); model.ReportedId = userId1; model.ReportingId = userId2; model.Report = report; try { await userInteractionService.CreateReportAsync(model); await userInteractionService.RemoveReportAsync(1); IEnumerable <UserReportsModel> userReports = await userReportsRepo.GetAllReports(); if (userReports == null) { Assert.IsTrue(false); } if (userReports.Count() == 0) { Assert.IsTrue(true); } } catch { Assert.IsTrue(false); } }
public async Task RemoveReportAsync_RemoveReport_ReportRemoved(int userId1, int userId2, string report) { Mock <IDataGateway> dataGateway = new Mock <IDataGateway>(); Mock <IConnectionStringData> connectionString = new Mock <IConnectionStringData>(); Mock <IFriendRequestListRepo> friendRequestListRepo = new Mock <IFriendRequestListRepo>( ); Mock <IFriendBlockListRepo> friendBlockListRepo = new Mock <IFriendBlockListRepo>( ); Mock <IFriendListRepo> friendListRepo = new Mock <IFriendListRepo>( ); Mock <IUserReportsRepo> userReportsRepo = new Mock <IUserReportsRepo>( ); Mock <IUserAccountRepository> userAccountRepository = new Mock <IUserAccountRepository>( ); Mock <IUserProfileRepository> userProfileRepository = new Mock <IUserProfileRepository>( ); Mock <IUserProfileService> userProfileService = new Mock <IUserProfileService>(); Mock <IUserAccountService> userAccountService = new Mock <IUserAccountService>(); Mock <IValidationService> validationService = new Mock <IValidationService>(); IUserInteractionService userInteractionService = new UserInteractionService(friendBlockListRepo.Object, friendListRepo.Object, friendRequestListRepo.Object, userReportsRepo.Object, validationService.Object); UserReportsModel model = new UserReportsModel(); model.ReportedId = userId1; model.ReportingId = userId2; model.Report = report; try { await userInteractionService.CreateReportAsync(model); await userInteractionService.RemoveReportAsync(1); } catch { Assert.IsTrue(false); } }