Exemple #1
0
        private void SetupShims(bool read, pspubsettings page)
        {
            ShimHttpRequest.AllInstances.ItemGetString = (_, __) =>
            {
                var result = string.Empty;
                return(result);
            };
            ShimSqlDataReader.AllInstances.Read           = _ => read;
            ShimPage.AllInstances.RequestGet              = _ => new ShimHttpRequest();
            ShimCoreFunctions.getConnectionStringGuid     = guid => string.Empty;
            ShimCoreFunctions.getConfigSettingSPWebString = (web, key) =>
            {
                var result = string.Empty;
                if (key == "epmlivepub-lock")
                {
                    result = "1";
                }
                else if (key == "EPMLivePub-Type")
                {
                    result = "SampleValue";
                }
                return(result);
            };

            ShimSPContext.AllInstances.SiteGet          = context => _sharepointShims.SiteShim;
            _sharepointShims.SiteShim.WebApplicationGet = () => _sharepointShims.ApplicationShim;


            var field = typeof(pspubsettings).GetField("ddlPubType", BindingFlags.Instance | BindingFlags.NonPublic);

            field.SetValue(page, new System.Web.UI.WebControls.DropDownList());
        }
Exemple #2
0
 public void SetUp()
 {
     _shimsContext       = ShimsContext.Create();
     _buttonClick1Method = typeof(pspubsettings).GetMethod("Button1_Click", BindingFlags.Instance | BindingFlags.NonPublic);
     _pspubsettings      = new pspubsettings();
     _args            = new EventArgs();
     _adoShims        = AdoShims.ShimAdoNetCalls();
     _sharepointShims = SharepointShims.ShimSharepointCalls();
 }
 public void SetUp()
 {
     _shimsContext    = ShimsContext.Create();
     _pageLoadMethod  = typeof(pspubsettings).GetMethod("Page_Load", BindingFlags.Instance | BindingFlags.NonPublic);
     _pspubsettings   = new pspubsettings();
     _args            = new EventArgs();
     _adoShims        = AdoShims.ShimAdoNetCalls();
     _sharepointShims = SharepointShims.ShimSharepointCalls();
     _getInt32Called  = false;
 }