public void ConstructorTest()
        {
            Mock <IIrcWriter> writer = new Mock <IIrcWriter>(MockBehavior.Strict);
            const string      line   = "line";

            AllHandlerArgs uut = new AllHandlerArgs(
                writer.Object,
                line
                );

            Assert.AreSame(writer.Object, uut.Writer);
            Assert.AreEqual(line, uut.Line);
        }
Beispiel #2
0
        public void TestSetup()
        {
            this.ircConfig        = TestHelpers.GetTestIrcConfig();
            this.ircWriter        = new Mock <IIrcWriter>(MockBehavior.Strict);
            this.responseReceived = null;

            AllHandlerConfig allHandlerConfig = new AllHandlerConfig
            {
                AllAction = this.AllFunction
            };

            this.uut = new AllHandler(allHandlerConfig);
        }
Beispiel #3
0
        /// <summary>
        /// Handles the end-of-names response from the server.
        /// </summary>
        /// <param name="writer">The IRC Writer to write to.</param>
        /// <param name="response">The response from the channel.</param>
        private void HandleEndOfNamesResponse(AllHandlerArgs args)
        {
            Tuple <string, string> foundUsers = this.userList.CheckAndHandleEndMessage(args.Line);

            if (foundUsers != null)
            {
                if (this.isQueried.ContainsKey(foundUsers.Item1) && this.isQueried[foundUsers.Item1])
                {
                    args.Writer.SendMessage(
                        string.Format("Users in {0}: {1}", foundUsers.Item1, foundUsers.Item2),
                        foundUsers.Item1
                        );
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Handles writing an event to the log.
        /// </summary>
        private void HandleLogEvent(AllHandlerArgs args)
        {
            bool log = true;

            for (int i = 0; i < (this.config.IgnoreRegexes.Count) && log; ++i)
            {
                if (config.IgnoreRegexes[i].IsMatch(args.Line))
                {
                    log = false;
                }
            }

            if (log)
            {
                this.logManager.AsyncLogToFile(args.Line);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Handles the names response from the server.
 /// Adds the names to the list.
 /// </summary>
 private void HandleNamesResponse(AllHandlerArgs args)
 {
     this.userList.ParseNameResponse(args.Line);
 }
Beispiel #6
0
        // -------- Test Helpers --------

        /// <summary>
        /// The function that is called
        /// </summary>
        /// <param name="writer">The writer that can be written to.</param>
        /// <param name="response">The response from the server.</param>
        private void AllFunction(AllHandlerArgs args)
        {
            Assert.AreSame(this.ircWriter.Object, args.Writer);
            this.responseReceived = args;
        }