コード例 #1
0
 private List <PegDetails> GetPenaltyPegs(List <Peg> pegs, int?requireKeywords, string[] keywords,
                                          string[] penaltyKeywords)
 {
     return(pegs.Where(y => _pegHelper.IsPenaltyPeg(y.Comment, requireKeywords, penaltyKeywords, keywords))
            .Select(y => new PegDetails
     {
         SenderName = y.Receiver.Username,
         Weight = 1,
         Comment = y.Comment,
         Keywords = penaltyKeywords.Where(z => y.Comment.Contains(z, StringComparison.OrdinalIgnoreCase)).ToList(),
         SenderLocation = y.Receiver.Location?.Location
     })
            .ToList());
 }
コード例 #2
0
 private void GivenPenaltyPeg(string penaltyKeyword)
 {
     _pegHelper.IsPenaltyPeg(Arg.Any <string>(), Arg.Any <int?>(), Arg.Any <string[]>(), Arg.Any <string[]>()).Returns(
         x => ((string)x[0]).Contains(penaltyKeyword));
 }