public void ThenBizTalkWillReceiveTheMessage(string portName)
        {
            Debug.WriteLine("BizTalkBill.TestingFramework.SpecFlow:SharedSteps:ThenBizTalkWillReceiveTheMessage(" + portName + ")");

            ApplicationEventLog.CheckForDiagnosticEvent("BizTalk has received a message on port - " + portName);

            System.Threading.Thread.Sleep(100);

            Int32  ReceiveCount = 0;
            string LastMessageTrackingDateTime = (string)ScenarioContext.Current["LastMessageTrackingDateTime"];

            new Logger().Write("LastMessageTrackingDateTime = " + LastMessageTrackingDateTime);

            string dbServerName = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\BizTalk Server\3.0\Administration", "MgmtDBServer", "localhost");

            using (SqlConnection connection2 = new SqlConnection("Data Source=" + dbServerName + ";Initial Catalog=BizTalkDTADb;Integrated Security=True"))
            {
                string sCommand2 = string.Format("SELECT TOP 1 convert(varchar(50),[Event/Timestamp],126)  FROM [BizTalkDTADb].[dbo].[dtav_MessageFacts] where [Event/Port] = '{0}' order by [Event/Timestamp] desc", portName);
                new Logger().Write("SQL Command = " + sCommand2);

                using (SqlCommand command2 = new SqlCommand(sCommand2, connection2))
                {
                    try
                    {
                        connection2.Open();

                        var lastfound = (string)command2.ExecuteScalar();

                        if (lastfound != null)
                        {
                            new Logger().Write("LastMessageFoundTrackingDateTime = " + lastfound);
                        }
                        else
                        {
                            new Logger().Write("returned null");
                        }
                    }
                    catch (Exception Ex1)
                    {
                        new Logger().Write("Error in LastMessageFoundTrackingDateTime - " + Ex1.ToString());
                        //throw;
                    }
                }
            }
            using (SqlConnection connection = new SqlConnection("Data Source=" + dbServerName + ";Initial Catalog=BizTalkDTADb;Integrated Security=True"))
            {
                string sCommand = string.Format("select count(*) FROM [BizTalkDTADb].[dbo].[dtav_MessageFacts] where [Event/Timestamp] > '{0}' and [Event/Port] = '{1}'", LastMessageTrackingDateTime, portName);
                new Logger().Write("SQL Command = " + sCommand);

                new Logger().Write("Starting Receive Check = " + DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fff"));
                for (int i = 1; i <= 20; i++)
                {
                    using (SqlCommand command = new SqlCommand(sCommand, connection))
                    {
                        try
                        {
                            connection.Open();
                            ReceiveCount = (Int32)command.ExecuteScalar();
                            connection.Close();

                            new Logger().Write("ReceiveCount = " + ReceiveCount.ToString());
                        }
                        catch (Exception Ex1)
                        {
                            new Logger().Write("Exception = " + Ex1.Message);
                            //throw;
                        }
                    }
                    new Logger().Write("Ending Receive Check = " + DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fff"));

                    if (ReceiveCount > 0)
                    {
                        Debug.WriteLine("Break");
                        break;
                    }
                    Debug.WriteLine("Looping");
                    if (i <= 5)
                    {
                        System.Threading.Thread.Sleep(500);
                    }
                    else
                    {
                        Int32 sleepTime = 3000 * (i - 5);
                        System.Threading.Thread.Sleep(sleepTime);
                    }
                }
            }

            Assert.IsFalse(ReceiveCount < 1, "Message Not Received on Port - " + portName);
        }