public void MsmqAccessDenied()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(logWriter, CommonUtil.MessageQueuePath, eventLogger);
            testSync.LogMsgQueueException(MessageQueueErrorCode.AccessDenied);

            string expected = string.Format(Resources.MsmqAccessDenied, CommonUtil.MessageQueuePath, WindowsIdentity.GetCurrent().Name);
            string actual = CommonUtil.GetLastEventLogEntry();
            Assert.IsTrue(actual.IndexOf(expected) > -1);
        }
Ejemplo n.º 2
0
        public void MsmqAccessDenied()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(logWriter, CommonUtil.MessageQueuePath, eventLogger);

            testSync.LogMsgQueueException(MessageQueueErrorCode.AccessDenied);
            string expected = string.Format(Resources.MsmqAccessDenied, CommonUtil.MessageQueuePath, WindowsIdentity.GetCurrent().Name);
            string actual   = CommonUtil.GetLastEventLogEntry();

            Assert.IsTrue(actual.IndexOf(expected) > -1);
        }
Ejemplo n.º 3
0
        public void MSMQInvalidTransactionUsage()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(Context);
            testSync.LogMsgQueueException(MessageQueueErrorCode.TransactionUsage);

            string expected = SR.MsmqInvalidTransactionUsage(CommonUtil.MessageQueuePath);

            //assert warning is written to event log
            Assert.IsTrue(CommonUtil.GetLastEventLogEntry().IndexOf(expected) > -1);
        }
Ejemplo n.º 4
0
        public void MSMQInvalidTransactionUsage()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(Context);

            testSync.LogMsgQueueException(MessageQueueErrorCode.TransactionUsage);

            string expected = SR.MsmqInvalidTransactionUsage(CommonUtil.MessageQueuePath);

            //assert warning is written to event log
            Assert.IsTrue(CommonUtil.GetLastEventLogEntry().IndexOf(expected) > -1);
        }
Ejemplo n.º 5
0
        public void MsmqRecieveTimeout()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(Context);
            testSync.LogMsgQueueException(MessageQueueErrorCode.IOTimeout);

            string expected = SR.MsmqReceiveTimeout(CommonUtil.MessageQueuePath);

            //assert warning is written to event log
            string actual = CommonUtil.GetLastEventLogEntry();
            Assert.IsTrue(actual.IndexOf(expected) > -1);
        }
Ejemplo n.º 6
0
        public void MsmqRecieveTimeout()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(Context);

            testSync.LogMsgQueueException(MessageQueueErrorCode.IOTimeout);

            string expected = SR.MsmqReceiveTimeout(CommonUtil.MessageQueuePath);

            //assert warning is written to event log
            string actual = CommonUtil.GetLastEventLogEntry();

            Assert.IsTrue(actual.IndexOf(expected) > -1);
        }
Ejemplo n.º 7
0
        public void IllFormattedMessageWritesInEventLog()
        {
            MsmqReceiverTestWrapper testSync        = new MsmqReceiverTestWrapper(logWriter, CommonUtil.MessageQueuePath, eventLogger);
            MsmqTraceListener       mqTracelistener = new MsmqTraceListener("unnamed", CommonUtil.MessageQueuePath, new BinaryLogFormatter(),
                                                                            MessagePriority.Normal, false, new TimeSpan(0, 1, 0), new TimeSpan(0, 1, 0),
                                                                            false, true, false, MessageQueueTransactionType.None);

            mqTracelistener.Write("this is a plain trace message");
            try
            {
                testSync.CheckForMessages();
            }
            catch (LoggingException) { }

            string eventlogEntry = CommonUtil.GetLastEventLogEntry();

            Assert.IsTrue(-1 != eventlogEntry.IndexOf("Unable to deserialize message"));
        }
Ejemplo n.º 8
0
        public void IllFormattedMessageWritesInEventLog()
        {
            MsmqReceiverTestWrapper testSync = new MsmqReceiverTestWrapper(logWriter, CommonUtil.MessageQueuePath, eventLogger);
            MsmqTraceListener mqTracelistener =  new MsmqTraceListener("unnamed", CommonUtil.MessageQueuePath, new BinaryLogFormatter(),
                                                      MessagePriority.Normal, false, new TimeSpan(0, 1, 0), new TimeSpan(0, 1, 0),
                                                      false, true, false, MessageQueueTransactionType.None);
            mqTracelistener.Write("this is a plain trace message");
            try
            {
                testSync.CheckForMessages();
            }
            catch (LoggingException)
            {
            }

            string eventlogEntry = CommonUtil.GetLastEventLogEntry();
            Assert.IsTrue(-1 != eventlogEntry.IndexOf("Unable to deserialize message"));
        }