예제 #1
0
        public void ShouldParseCorrectly4()
        {
            // arrange
            string message = "PRSDS foo bar baz";
            var expected = new Message("PRSDS", new[] { "foo", "bar", "baz" });

            this.DoParseTest(message, expected);
        }
예제 #2
0
        public void ShouldParseCorrectly3()
        {
            // arrange
            string message = "PRSDS";
            var expected = new Message("PRSDS");

            this.DoParseTest(message, expected);
        }
예제 #3
0
        public void ShouldParseCorrectly2()
        {
            // arrange
            string message = ":bla MODE foo bar :do something!";
            var expected = new Message("bla", "MODE", new List<string> { "foo", "bar", "do something!" });

            this.DoParseTest(message, expected);
        }
예제 #4
0
        public void ShouldParseCorrectly()
        { 
            // arrange
            string message = ":server 001 :Welcome!";
            var expected = new Message("server", "001", new[] { "Welcome!" });

            this.DoParseTest(message, expected);
        }
예제 #5
0
        public void ShouldParseCorrectly5()
        {
            // arrange
            string message = ":hobana.freenode.net 354 stwalker|test 001 #wikipedia-en ~Marco 2a00:1158:2:7700::16 Gnumarcoo_ G 0";
            var expected = new Message(
                "hobana.freenode.net",
                "354",
                new List<string>
                    {
                        "stwalker|test",
                        "001",
                        "#wikipedia-en",
                        "~Marco",
                        "2a00:1158:2:7700::16",
                        "Gnumarcoo_",
                        "G",
                        "0"
                    });

            this.DoParseTest(message, expected);
        }
예제 #6
0
        /// <summary>
        /// The do parse test.
        /// </summary>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <param name="expected">
        /// The expected.
        /// </param>
        private void DoParseTest(string message, Message expected)
        {
            // act
            var actual = (Message)Message.Parse(message);

            // assert
            Assert.That(actual.Prefix, Is.EqualTo(expected.Prefix));
            Assert.That(actual.Command, Is.EqualTo(expected.Command));
            Assert.That(actual.Parameters, Is.EqualTo(expected.Parameters));
        }