public void TestInitialize()
        {
            _shimsContext = ShimsContext.Create();
            ShimIntegrationCoreMethods();
            ShimSharePointMethods();

            _guid1           = Guid.NewGuid();
            _guid2           = Guid.NewGuid();
            _dummyGuid       = Guid.NewGuid();
            _queries         = new List <string>();
            _queriesParams   = new Dictionary <string, object>();
            _fields          = new Dictionary <string, SPField>();
            _listUpdated     = false;
            _fieldUpdated    = false;
            _fieldDeleted    = false;
            _eventsDeleted   = 0;
            _propertiesSaved = null;

            _integrationCore = new IntegrationCore(_guid1, _guid2);
            _testObject      = new IntegrationAdmin(_integrationCore, _guid1, Guid.Empty);
            _privateObject   = new PrivateObject(_testObject);
        }
        private string GetUrlFromSourceToDestinationColumns(
            SqlConnection sqlConnection,
            string integrationId,
            string control,
            Guid siteId,
            Guid webId,
            string id,
            Guid listId,
            Guid internalListUId)
        {
            var url        = string.Empty;
            var sqlCommand = new SqlCommand(
                @"SELECT     INT_LISTS_1.INT_COLID, dbo.INT_LISTS.LIST_ID, dbo.INT_LISTS.INT_COLID AS Expr1, dbo.INT_LISTS.SITE_ID, dbo.INT_LISTS.WEB_ID, 
                                                                      INT_LISTS_1.INT_LIST_ID
                                                                        FROM         dbo.INT_CONTROLS INNER JOIN
                                                                      dbo.INT_LISTS AS INT_LISTS_1 ON dbo.INT_CONTROLS.INT_LIST_ID = INT_LISTS_1.INT_LIST_ID RIGHT OUTER JOIN
                                                                      dbo.INT_LISTS ON INT_LISTS_1.LIST_ID = dbo.INT_LISTS.LIST_ID WHERE     (dbo.INT_LISTS.INT_LIST_ID = @integrationid) and Control=@control",
                sqlConnection);

            sqlCommand.Parameters.AddWithValue("@integrationid", integrationId);
            sqlCommand.Parameters.AddWithValue("@control", control);

            var destinationColumnId = 0;
            var sourceColumnId      = 0;

            using (var dataReader = sqlCommand.ExecuteReader())
            {
                if (dataReader.Read())
                {
                    if (!dataReader.IsDBNull(0))
                    {
                        destinationColumnId = dataReader.GetInt32(0);
                    }

                    sourceColumnId = dataReader.GetInt32(2);

                    SPSecurity.RunWithElevatedPrivileges(
                        delegate
                    {
                        var core   = new IntegrationCore(siteId, webId);
                        var itemId = string.Empty;
                        if (!string.IsNullOrWhiteSpace(id))
                        {
                            using (var site = new SPSite(siteId))
                            {
                                using (var web = site.OpenWeb(webId))
                                {
                                    var list = web.Lists[listId];

                                    try
                                    {
                                        var query = new SPQuery
                                        {
                                            Query = string.Format(
                                                "<Where><Eq><FieldRef Name='INTUID{0}'/><Value Type='Text'>{1}</Value></Eq></Where>",
                                                sourceColumnId,
                                                id)
                                        };

                                        var listItemCollection = list.GetItems(query);

                                        if (listItemCollection.Count > 0)
                                        {
                                            itemId = listItemCollection[0]["INTUID" + destinationColumnId]
                                                     .ToString();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        System.Diagnostics.Trace.TraceError("Exception suppressed {0}", ex);
                                    }
                                }
                            }

                            if (itemId != string.Empty)
                            {
                                url = core.GetControlURL(internalListUId, listId, control, itemId);
                            }
                            else
                            {
                                lblMessage.Text = "Couldn't find matching ID";
                            }
                        }
                        else
                        {
                            url = core.GetControlURL(internalListUId, listId, control, string.Empty);
                        }
                    });
                }
                else
                {
                    lblMessage.Text = "Invalid Control";
                }
            }
            return(url);
        }