/// <summary> /// 添加用户意见反馈记录 /// </summary> public ServiceInvokeDTO AddFeedBackRecord(FeedbackRecord feedback) { log.Debug(Constant.DEBUG_START); ServiceInvokeDTO result = null; try { // 验证参数 FeedbackValidator validator = new FeedbackValidator(); ValidationResult validatorResult = validator.Validate(feedback); if (validatorResult.IsValid) { feedBackDAL.Insert(feedback); result = new ServiceInvokeDTO(InvokeCode.SYS_INVOKE_SUCCESS); } else { result = new ServiceInvokeDTO(InvokeCode.SYS_ARG_ERROR); log.Error(string.Format(Constant.DEBUG_ARG_ERROR_FORMATER, validatorResult.Errors[0].ErrorMessage)); } } catch (Exception ex) { log.Error(ex); throw ex; } log.Debug(Constant.DEBUG_END); return result; }
public PhonesController(ApplicationDbContext context, PhoneValidator phoneValidator, FeedbackValidator feedbackValidator) { _context = context; _phoneValidator = phoneValidator; _feedbackValidator = feedbackValidator; }
public void CheckForRatingAbove5FromPlaceFeedback() { FeedbackValidator feedbackValidator = new FeedbackValidator(); var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 6, userName = "******" }; feedbackValidator.placeFeedback(feedback); }
public void CheckWhiteSpaceUserNameFromPlaceFeedback() { FeedbackValidator feedbackValidator = new FeedbackValidator(); var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }; feedbackValidator.placeFeedback(feedback); }
public void CheckForDuplicateEmailAddress() { Dictionary <string, FeedbackEntity> currentFeedback = new Dictionary <string, FeedbackEntity>(StringComparer.InvariantCultureIgnoreCase); Dictionary <string, string> currentEmails = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); currentEmails.Add("*****@*****.**", "Mazon"); FeedbackValidator feedbackValidator = new FeedbackValidator(currentFeedback, currentEmails); feedbackValidator.CheckEmailAddress("*****@*****.**"); }
public void CheckUserNameWithSpecialCharFromPlaceFeedback() { FeedbackValidator feedbackValidator = new FeedbackValidator(); var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }; feedbackValidator.placeFeedback(feedback); }
public void CheckForInvalidEmailAddressFromPlaceFeedback() { FeedbackValidator feedbackValidator = new FeedbackValidator(); var feedback = new FeedbackEntity() { email = "email@email", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }; feedbackValidator.placeFeedback(feedback); }
public void CheckValidUserName() { FeedbackValidator feedbackValidator = new FeedbackValidator(); try { feedbackValidator.CheckUserName("Mazon"); } catch (Exception) { Assert.IsTrue(false, "Username should be Valid"); } }
public FeedbackController( ILogger <ChallengeController> logger, IDistributedCache cache, FeedbackValidator validator, ChallengeService challengeService, FeedbackService feedbackService, PlayerService playerService ) : base(logger, cache, validator) { ChallengeService = challengeService; FeedbackService = feedbackService; PlayerService = playerService; }
public void CheckForValidEmailAddress3() { FeedbackValidator feedbackValidator = new FeedbackValidator(); try { feedbackValidator.CheckEmailAddress("*****@*****.**"); } catch (Exception) { Assert.IsTrue(false, "The email address [email protected] should be valid"); } }
public void CheckForDuplicateFeedbackWithDifferentCasing() { Dictionary <string, FeedbackEntity> currentFeedback = new Dictionary <string, FeedbackEntity>(StringComparer.InvariantCultureIgnoreCase); Dictionary <string, string> currentEmails = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); currentFeedback.Add("MAZON", new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }); FeedbackValidator feedbackValidator = new FeedbackValidator(currentFeedback, currentEmails); feedbackValidator.CheckUserNameNotUsed("mazon"); }
public void CheckForDuplicateEmailAddressFromPlaceFeedback() { Dictionary <string, FeedbackEntity> currentFeedback = new Dictionary <string, FeedbackEntity>(StringComparer.InvariantCultureIgnoreCase); Dictionary <string, string> currentEmails = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase); currentEmails.Add("*****@*****.**", "Mazon"); FeedbackValidator feedbackValidator = new FeedbackValidator(currentFeedback, currentEmails); var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }; feedbackValidator.placeFeedback(feedback); }
public void CheckForValidEmailAddressFromPlaceFeedback() { FeedbackValidator feedbackValidator = new FeedbackValidator(); try { var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "Hey Great stuff", rating = 1, userName = "******" }; feedbackValidator.placeFeedback(feedback); } catch (Exception) { Assert.IsTrue(false, "The email address [email protected] should be valid"); } }
public void CheckThatBlankFeedbackIsValid() { FeedbackValidator feedbackValidator = new FeedbackValidator(); var feedback = new FeedbackEntity() { email = "*****@*****.**", date = DateTime.Now, feedback = "", rating = 1, userName = "******" }; try { feedbackValidator.placeFeedback(feedback); } catch (Exception) { Assert.IsTrue(false, "Blank feedback should be valid"); } }
public void CheckForValidRating() { FeedbackValidator feedbackValidator = new FeedbackValidator(); try { feedbackValidator.CheckRating(1); feedbackValidator.CheckRating(2); feedbackValidator.CheckRating(3); feedbackValidator.CheckRating(4); feedbackValidator.CheckRating(5); } catch (Exception) { Assert.IsTrue(false, "All ratings between 1 to 5 should be valid"); } }
public void CheckEmptyUserName() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckUserName(""); }
public void CheckNegativeRating() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckRating(-1); }
public void CheckUserNameWithSpecialChar() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckUserName("Mazon!"); }
public void CheckUserNameWithNumbers() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckUserName("Mazon1"); }
public void CheckForZeroRating() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckRating(0); }
public void CheckForRatingAbove5() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckRating(6); }
public void CheckWhiteSpaceUserName() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckUserName(" "); }
public void CheckUserNameThatIsTooLong() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckUserName("MazonMazonMazonMazonM"); }
public void CheckForInvalidEmailAddress3() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckEmailAddress("email@email@com"); }
public void CheckForBlankEmailAddress() { FeedbackValidator feedbackValidator = new FeedbackValidator(); feedbackValidator.CheckEmailAddress(""); }