private void InitCommonShim() { _viewState = Get <StateBag>(_privateGroupExplorerObj, "ViewState"); ShimSqlConnection.AllInstances.Open = (conn) => { }; ShimSqlConnection.AllInstances.Close = (conn) => { }; ShimSqlCommand.AllInstances.ConnectionGet = (cmd) => new ShimSqlConnection(); PlatformFake.ShimUser.HasAccessUserEnumsServicesEnumsServiceFeaturesEnumsAccess = (user, service, code, access) => true; ShimUser.HasAccessUserEnumsServicesEnumsServiceFeaturesEnumsAccess = (user, service, code, access) => true; ShimAccessCheck.CanAccessByCustomerOf1M0User <List <CommunicatorEntites.Filter> >((filter, user) => true); ShimAccessCheck.CanAccessByCustomerOf1M0User <CommunicatorEntites.CampaignItem>((filter, user) => true); ShimGroup.ExistsInt32Int32 = (groupId, custId) => true; ShimFolderSystemBase.AllInstances.LoadFolderTree = (f) => { }; ShimDirectory.ExistsString = (path) => false; ShimDirectory.CreateDirectoryString = (path) => { return(null); }; ShimFileStream.ConstructorStringFileModeFileAccess = (st, path, mode, access) => { }; ShimFileStream.AllInstances.CanWriteGet = (st) => true; ShimStream.AllInstances.Close = (s) => { }; ShimXmlTextWriter.AllInstances.Flush = (writer) => { }; ShimXmlTextWriter.AllInstances.Close = (writer) => { }; ShimPath.CombineStringString = (path1, path2) => string.Empty; ShimHttpResponse.AllInstances.WriteFileString = (r, path) => { }; ShimHttpResponse.AllInstances.Flush = (r) => { }; ShimHttpResponse.AllInstances.End = (r) => { }; ShimPage.AllInstances.ResponseGet = (p) => new ShimHttpResponse(); var updatePanel = Get <UpdatePanel>(_privateGroupExplorerObj, UpMainId); updatePanel.ID = "upId"; updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional; }
private void InitTestForBindPreview( List <CommEntities.EmailPreview> emailPreviews = null, string previewHtml = "", CodeAnalysisTest codeAnalysisTest = null, List <CodeAnalysisResult> codeAnalysisResults = null, LinkTest linkTest = null, List <TestingApplication> testingApplicationList = null, bool shimEncryption = true) { InitCommonShimForBindPreview(); SetPageControlsForBindPreview(); SetPagePropertiesForBindPreview(); Set(CodeAnalysisResultFieldName, codeAnalysisResults); FakeCommData.ShimEmailPreview.GetListSqlCommand = (cmd) => emailPreviews; FakeCommData.ShimBlast.GetByBlastIDInt32 = (id) => new CommEntities.BlastSMS() { LayoutID = 1 }; ShimLayout.GetPreviewInt32EnumsContentTypeCodeBooleanUserNullableOfInt32NullableOfInt32NullableOfInt32 = (id, type, isMobile, user, emailID, groupID, blastid) => previewHtml; KM.Platform.Fakes.ShimUser.HasAccessUserEnumsServicesEnumsServiceFeaturesEnumsAccess = (user, service, feature, view) => true; ShimAccessCheck.CanAccessByCustomerOf1M0User <CommEntities.BlastAbstract>((blastAbstract, user) => true); ShimAccessCheck.CanAccessByCustomerOf1M0EnumsServicesEnumsServiceFeaturesEnumsAccessUser <CommEntities.BlastFields>((fields, code, feature, access, user) => true); FakeCommData.ShimBlastFields.GetSqlCommand = (command) => CreateBlastFieldsForBindPreview(); ShimPreview.AllInstances.GetCodeAnalysisTestString = (p, html) => codeAnalysisTest; ShimRestClient.AllInstances.ExecuteOf1IRestRequest((client, req) => { var serializedLinkTest = JsonConvert.SerializeObject(linkTest); var response = new RestResponse <LinkTest>(); response.Content = serializedLinkTest; return(response); }); ShimRestClient.AllInstances.ExecuteOf1IRestRequest((client, req) => { var emailTest = new EmailTest(); emailTest.TestingApplications = testingApplicationList; var serializedEmailTest = JsonConvert.SerializeObject(emailTest); var response = new RestResponse <EmailTest>(); response.Content = serializedEmailTest; return(response); }); ShimRestClient.AllInstances.ExecuteOf1IRestRequest((client, req) => { var testingAppList = new List <TestingApplication>(); testingAppList.Add(new TestingApplication() { ApplicationName = "2" }); var serializedTestingAppList = JsonConvert.SerializeObject(testingAppList); var response = new RestResponse <List <TestingApplication> >(); response.Content = serializedTestingAppList; return(response); }); if (shimEncryption) { ShimEncryption.GetCurrentByApplicationIDInt32 = (id) => new Encryption(); } }
private void InitCommonShimForTestGroupExplorer() { _viewState = Get <StateBag>(_privateGroupExplorerObj, "ViewState"); ShimSqlConnection.AllInstances.Open = (conn) => { }; ShimSqlConnection.AllInstances.Close = (conn) => { }; ShimSqlCommand.AllInstances.ConnectionGet = (cmd) => new ShimSqlConnection(); PlatformFake.ShimUser.HasAccessUserEnumsServicesEnumsServiceFeaturesEnumsAccess = (user, service, code, access) => true; ShimUser.HasAccessUserEnumsServicesEnumsServiceFeaturesEnumsAccess = (user, service, code, access) => true; ShimAccessCheck.CanAccessByCustomerOf1M0User <List <CommunicatorEntites.Filter> >((filter, user) => true); ShimAccessCheck.CanAccessByCustomerOf1M0User <CommunicatorEntites.CampaignItem>((filter, user) => true); ShimGroup.ExistsInt32Int32 = (groupId, custId) => true; ShimHttpResponse.AllInstances.WriteFileString = (r, path) => { }; ShimHttpResponse.AllInstances.Flush = (r) => { }; ShimHttpResponse.AllInstances.End = (r) => { }; ShimPage.AllInstances.ResponseGet = (p) => new ShimHttpResponse(); var updatePanel = Get <UpdatePanel>(_privateGroupExplorerObj, UpMainId); updatePanel.ID = "upId"; updatePanel.UpdateMode = UpdatePanelUpdateMode.Conditional; }