Пример #1
0
        public void ParseComplex()
        {
            var modeMap = new ChannelModeMap();
            List <ChannelModeChangeInfo> changeInfos;
            ChannelModeChangeInfo        changeInfo;

            changeInfos = ChannelModeChangeInfo.Parse(modeMap, "#test", "-l+o-k+v", "op_nick * voice_nick");
            Assert.IsNotNull(changeInfos);
            Assert.AreEqual(4, changeInfos.Count);

            changeInfo = changeInfos[0];
            Assert.AreEqual(ChannelModeChangeAction.Unset, changeInfo.Action);
            Assert.AreEqual(ChannelMode.UserLimit, changeInfo.Mode);
            Assert.AreEqual('l', changeInfo.ModeChar);
            Assert.AreEqual(null, changeInfo.Parameter);

            changeInfo = changeInfos[1];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Op, changeInfo.Mode);
            Assert.AreEqual('o', changeInfo.ModeChar);
            Assert.AreEqual("op_nick", changeInfo.Parameter);

            changeInfo = changeInfos[2];
            Assert.AreEqual(ChannelModeChangeAction.Unset, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Key, changeInfo.Mode);
            Assert.AreEqual('k', changeInfo.ModeChar);
            Assert.AreEqual("*", changeInfo.Parameter);

            changeInfo = changeInfos[3];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Voice, changeInfo.Mode);
            Assert.AreEqual('v', changeInfo.ModeChar);
            Assert.AreEqual("voice_nick", changeInfo.Parameter);
        }
Пример #2
0
        public void ParseWithParameter()
        {
            var modeMap = new ChannelModeMap();
            List <ChannelModeChangeInfo> changeInfos;
            ChannelModeChangeInfo        changeInfo;

            changeInfos = ChannelModeChangeInfo.Parse(modeMap, "#test", "+o", "meebey");
            Assert.IsNotNull(changeInfos);
            Assert.AreEqual(1, changeInfos.Count);

            changeInfo = changeInfos[0];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Op, changeInfo.Mode);
            Assert.AreEqual('o', changeInfo.ModeChar);
            Assert.AreEqual("meebey", changeInfo.Parameter);
        }
Пример #3
0
        public void ParseWithoutParameter()
        {
            var modeMap = new ChannelModeMap();
            List <ChannelModeChangeInfo> changeInfos;
            ChannelModeChangeInfo        changeInfo;

            changeInfos = ChannelModeChangeInfo.Parse(modeMap, "#test", "+nt", "");
            Assert.IsNotNull(changeInfos);
            Assert.AreEqual(2, changeInfos.Count);

            changeInfo = changeInfos[0];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Unknown, changeInfo.Mode);
            Assert.AreEqual('n', changeInfo.ModeChar);
            Assert.AreEqual(null, changeInfo.Parameter);

            changeInfo = changeInfos[1];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.TopicLock, changeInfo.Mode);
            Assert.AreEqual('t', changeInfo.ModeChar);
            Assert.AreEqual(null, changeInfo.Parameter);
        }
Пример #4
0
        public void ParseUnknown()
        {
            var modeMap = new ChannelModeMap();
            List <ChannelModeChangeInfo> changeInfos;
            ChannelModeChangeInfo        changeInfo;

            changeInfos = ChannelModeChangeInfo.Parse(modeMap, "#test", "+X-Y", "foo bar");
            Assert.IsNotNull(changeInfos);
            Assert.AreEqual(2, changeInfos.Count);

            changeInfo = changeInfos[0];
            Assert.AreEqual(ChannelModeChangeAction.Set, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Unknown, changeInfo.Mode);
            Assert.AreEqual('X', changeInfo.ModeChar);
            Assert.AreEqual("foo", changeInfo.Parameter);

            changeInfo = changeInfos[1];
            Assert.AreEqual(ChannelModeChangeAction.Unset, changeInfo.Action);
            Assert.AreEqual(ChannelMode.Unknown, changeInfo.Mode);
            Assert.AreEqual('Y', changeInfo.ModeChar);
            Assert.AreEqual("bar", changeInfo.Parameter);
        }