public async Task RemoveFriendBlockAsync_RemoveBlock_BlockRemoved(int userId1, int userId2) { 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); try { await userInteractionService.CreateBlockAsync(userId1, userId2); await userInteractionService.RemoveFriendBlockAsync(userId1, userId2); } catch { Assert.IsTrue(false); } }
public async Task GetAllBlockingUsers_CreatBlock_BlockCreated(int userId1, int userId2) { 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); try { await userInteractionService.CreateBlockAsync(userId1, userId2); IEnumerable <FriendsListJunctionModel> friendsListJunctionModels = await userInteractionService.GetAllBlockingUsers(userId1); } catch { Assert.IsTrue(false); } }
public async Task GetAllBlockingUsers_CreatBlock_BlockCreated(int userId1, int userId2) { 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); try { await userInteractionService.CreateBlockAsync(userId1, userId2); IEnumerable <FriendsListJunctionModel> friendsListJunctionModels = await userInteractionService.GetAllBlockingUsers(userId1); if (friendsListJunctionModels == null) { Assert.IsTrue(false); } if (friendsListJunctionModels.Count() == 0) { Assert.IsTrue(false); } foreach (var friendsListJunctionModel in friendsListJunctionModels) { if (friendsListJunctionModel.User1Id == userId1 && friendsListJunctionModel.User2Id == userId2) { Assert.IsTrue(true); } } } catch { Assert.IsTrue(false); } }
public async Task RemoveFriendBlockAsync_RemoveBlock_BlockRemoved(int userId1, int userId2) { 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); try { await userInteractionService.CreateBlockAsync(userId1, userId2); await userInteractionService.RemoveFriendBlockAsync(userId1, userId2); IEnumerable <FriendsListJunctionModel> friendsListJunctionModels = await friendBlockListRepo.GetAllFriendBlocks(); if (friendsListJunctionModels == null) { Assert.IsTrue(false); } if (friendsListJunctionModels.Count() == 0) { Assert.IsTrue(true); } } catch { Assert.IsTrue(false); } }