コード例 #1
0
    public void GetMatchingPhrase_MessageQuestion_ShouldReturnMatch(string input, int expectedResult)
    {
        var list = new List <string> {
            "yes, you have three new messages", "sure, I can check your messages", "yes, you have three pending messages"
        };
        var result = PhraseMatching.GetMatchingPhrase(input, list);

        Assert.True(list.IndexOf(result[0]) == expectedResult);
    }
コード例 #2
0
    public void GetMatchingPhrase_ShiftQuestion_ShouldReturnMatch(string input, int expectedResult)
    {
        var list = new List <string> {
            "your next shift is tomorrow at 10am", "you are working next tomorrow at 10am", "you have to go to work tomorrow at 10am"
        };
        var result = PhraseMatching.GetMatchingPhrase(input, list);

        Assert.True(list.IndexOf(result[0]) == expectedResult);
    }
コード例 #3
0
    public void GetMatchingPhrase_MeetingQuestion_ShouldReturnMatch(string input, int expectedResult)
    {
        var list = new List <string> {
            "yes, a meeting is scheduled for you tomorrow", "yes, you do have a meeting tomorrow", "yes, you are meeting someone tommorow"
        };
        var result = PhraseMatching.GetMatchingPhrase(input, list);

        Assert.True(list.IndexOf(result[0]) == expectedResult);
    }
コード例 #4
0
    public void ProcessUserInput_SimilarSoundingWords_ShouldReturnMatchingExpectation(string userInput, string expectedValue)
    {
        // Arrange
        var phrases = new List <string> {
            "you are scheduled to work on friday",
            "yes I do have a name, it's Bambi",
            "my name is Bambi",
            "you are probably going to wrok on friday",
            "you are my favorite company",
            "the CEO of Facebook is, hmm, I don't know that one",
            "my favorite color is Daisy white"
        };

        // Act
        var matches = PhraseMatching.GetMatchingPhrase(userInput, phrases);

        // Assert
        Assert.NotNull(matches);
        Assert.True(matches[0] == expectedValue);
    }