Example #1
0
        public void Constructor()
        {
            DatabaseSinkData sinkParams = new DatabaseSinkData();
            sinkParams.DatabaseInstanceName = "LoggingDb";
            sinkParams.StoredProcName = "WriteLog";
            this.sink = CreateSink(sinkParams);
            DatabaseSink sink = CreateSink(sinkParams);

            Assert.IsNotNull(sink);
        }
Example #2
0
        public void Setup()
        {
            DatabaseSinkData sinkParams = new DatabaseSinkData();
            sinkParams.DatabaseInstanceName = "LoggingDb";
            sinkParams.StoredProcName = "WriteLog";
            this.sink = CreateSink(sinkParams);

            string sql = "delete from Log";
            DBCommandWrapper cmd = db.GetSqlStringCommandWrapper(sql);
            db.ExecuteNonQuery(cmd);

            CommonUtil.ResetEventLogCounter();
        }
Example #3
0
        public void NullStoredProcName()
        {
            DatabaseSinkData sinkParams = new DatabaseSinkData();
            sinkParams.DatabaseInstanceName = "Service_Dflt";
            sinkParams.StoredProcName = null;

            // create a flatfile sink without the required parameters
            DatabaseSink badSink = CreateSink(new DatabaseSinkData());

            CommonUtil.SendTestMessage(badSink);

            // confirm an error message was written to event log
            Assert.AreEqual(1, CommonUtil.EventLogEntryCount());

            string expected = SR.DatabaseSinkMissingParameters;
            string entry = CommonUtil.GetLastEventLogEntry();
            Assert.IsTrue(entry.IndexOf(expected) > -1, "confirm error message");
        }