Пример #1
0
        public void ValidateParameterName_Throws_IfInvalid(string name)
        {
            // Act
            ArgumentException ex = Assert.Throws <ArgumentException>(() => SlackCommand.ValidateParameterName(name));

            // Assert
            Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Parameter name cannot contain ';' characters: ({0}).", name.Replace("\\\0", ";")), ex.Message);
        }
Пример #2
0
        public void EncodeNonSeparatorCharacters_Throws_IfInvalidInput(string input, char quote, int offset)
        {
            // Act
            ArgumentException ex = Assert.Throws <ArgumentException>(() => SlackCommand.EncodeNonSeparatorCharacters(input));

            // Assert
            Assert.Equal(string.Format(CultureInfo.CurrentCulture, "Unmatched quote ({0}) discovered at position {1}.", quote, offset), ex.Message);
        }
Пример #3
0
        public void ValidateParameterName_Throws_IfQuotedName(string name)
        {
            // Act
            ArgumentException ex = Assert.Throws <ArgumentException>(() => SlackCommand.ValidateParameterName(name));

            // Assert
            Assert.StartsWith(string.Format(CultureInfo.CurrentCulture, "Parameter name cannot be a quoted string: ({0}).", name), ex.Message);
        }
Пример #4
0
        public void EncodeNonSeparatorCharacters_ParsesCorrectInput(string input, string expected)
        {
            // Act
            string actual = SlackCommand.EncodeNonSeparatorCharacters(input);

            // Assert
            Assert.Equal(expected, actual);
        }
Пример #5
0
        public void ParseActionWithValue_HandlesInput(string text, KeyValuePair <string, string> expected)
        {
            // Act
            KeyValuePair <string, string> actual = SlackCommand.ParseActionWithValue(text);

            // Assert
            Assert.Equal(expected, actual);
        }
Пример #6
0
        public void ParseActionWithParameters_HandlesInput(string text, string expectedAction, string expectedParameters)
        {
            // Act
            KeyValuePair <string, NameValueCollection> actual = SlackCommand.ParseActionWithParameters(text);

            // Assert
            Assert.Equal(expectedAction, actual.Key);
            Assert.Equal(expectedParameters, actual.Value.ToString());
        }
Пример #7
0
 public void ValidateParameterName_Accepts_ValidName(string name)
 {
     SlackCommand.ValidateParameterName(name);
 }