public void ClickTheButtonByAttributeValue(string atribute, string atrributeValue) { var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable (driver.FindElement(HelperFactory.SelectorByAttributeValue(atribute, atrributeValue)))).Click(); }
void BindData() { CategoryHelper helper = HelperFactory.GetHelper <CategoryHelper>(); DataGridView.DataSource = helper.GetCategoryByParentID(We7Helper.EmptyGUID); DataGridView.DataBind(); }
protected void SaveButton_ServerClick(object sender, EventArgs e) { if (DemoSiteMessage) { return; //是否是演示站点 } List <ChannelModuleMapping> mappings = HelperFactory.GetHelper <ChannelModuleHelper>().GetMappingByChannelID(ChannelID); if (mappings == null || mappings.Count <= 0) { HelperFactory.GetHelper <ChannelModuleHelper>().CreateMapping(ChannelID, "{928b8e2f-b004-47bb-adef-2053bd8a0db0}", string.Empty); } if (ChannelNameTextBox.Text.Contains("_")) { Messages.ShowMessage("此栏目标识包含非法“_”,请重新起名"); return; } if (ChannelID == null || ChannelID == "" || ChannelNameHidden.Text.Trim() == "") { string channelName = CoverToPinyin.Convert(ChannelNameTextBox.Text.ToLower().Trim()); if (!CheckName(channelName)) { Messages.ShowError("已存在此栏目标识“" + channelName + "”,栏目标识不能重复,请重新编辑。"); return; } ChannelNameHidden.Text = channelName; } SaveInformation(); }
private void ProcessRequest() { bool result = false; Response.ContentType = "text/html"; string key = Request.QueryString["key"]; string type = Request.QueryString["type"]; string catType = Request.QueryString["cattype"]; if (!String.IsNullOrEmpty(key)) { CategoryHelper helper = HelperFactory.GetHelper <CategoryHelper>(); if (type == "1") { //result=helper.FindCatetory(key, catType)!=null; } else { //Category cat = helper.GetCategorys(catType); //result=GetCatByName(cat, key) != null; //TODO::检查名称是否重复 } } Response.Clear(); Response.Write(result.ToString().ToLower()); }
/// <summary> /// 初始化 /// </summary> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); Links = new List <Link>(); LinkHelper LinkHelper = HelperFactory.GetHelper <LinkHelper>(); if (tag.Contains(",")) { tag = tag.Substring(0, tag.IndexOf(",")); } if (DesignHelper.IsDesigning) { List <Link> links; DesignHelper.FillItems <Link>(out links, PageSize); foreach (Link link in links) { link.Thumbnail = DesignHelper.GetTagThumbnail("small"); } Links = links; } else { Links = LinkHelper.GetPagedAllLinks(0, PageSize, "", tag); } if (ColumnCount <= 0) { columnCount = PageSize; } }
/// <summary> /// 增加一条操作记录 /// </summary> /// <param name="pages"></param> /// <param name="content"></param> public void AddLog(string pages, string content) { HelperFactory HelperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; LogHelper LogHelper = HelperFactory.GetHelper <LogHelper>(); if (Config.IsAddLog) { LogHelper.WriteLog(Security.CurrentAccountID, pages, content, Config.DefaultHomePageTitle); } }
public IHttpActionResult FindEmployee(EmployeeModel employeeModel) { //if (!ModelState.IsValid) // throw new IncorrectDataException(ModelState); if (_helper == null) { _helper = HelperFactory.Create(User, db); } return(Ok(_helper.FindEmployees(employeeModel))); }
public void EnterValueIntoInputFieldByAttributeValue(string attributeName, string attribute, string inputValue) { var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); // wait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(StaleElementReferenceException)); wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible((HelperFactory.SelectorByAttributeValue(attributeName, attribute)))); var inputField = driver.FindElement(HelperFactory.SelectorByAttributeValue(attributeName, attribute)); inputField.Clear(); inputField.SendKeys(inputValue); }
/// <summary> /// Check the system root folder in documents /// </summary> public EllyApplication() { epath = HelperFactory.GetModuleByType <EPath>(); if (epath == null) { Debug.Log(GetInfo().ModuleName, "Cannot get EPath", Debug.DebugType.LogError); return; } InitializeFolder(); ReadAppinfo(); }
protected void btnCreateIndex_Click(object sender, EventArgs e) { try { DataControlHelper dchelper = HelperFactory.GetHelper <DataControlHelper>(); dchelper.CreateDataControlIndex(); ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('重建索引成功!')", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "msg", "alert('重建索引失败:" + ex.Message + "')", true); } }
/// <summary> /// 取得当前反馈的模型名称 /// </summary> /// <returns></returns> protected virtual string GetModelName() { if (String.IsNullOrEmpty(ModelName)) { if (String.IsNullOrEmpty(AdviceTypeID)) { throw new Exception("反馈类型为空"); } AdviceType adviceType = HelperFactory.GetHelper <AdviceTypeHelper>().GetAdviceType(AdviceTypeID); ModelName = adviceType != null ? adviceType.ModelName : String.Empty; } return(ModelName); }
/// <summary> /// 执行 /// </summary> public override void Execute() { CommentsHelper CommentsHelper = HelperFactory.GetHelper <CommentsHelper>(); if (!string.IsNullOrEmpty(ArticleIDByRedirect)) { Records = CommentsHelper.ArticleIDQueryComments(ArticleIDByRedirect, this.StartIndexs, PageSize, null, true); } else { Records = CommentsHelper.ArticleIDQueryComments(ArticleID, this.StartIndexs, PageSize, null, true); } }
/// <summary> /// Reading data from "document/data/language" /// And if there is no data in the folder, create a empty one. /// </summary> public override void OnLoad() { base.OnLoad(); epath = HelperFactory.GetModuleByType <EPath>(); if (epath == null) { Debug.Log(GetInfo().ModuleName, "Cannot get EPath", Debug.DebugType.LogError); return; } ReadAppLanguage(); }
}//CheckServerChanges /// <summary> /// SyncRequestResponseStorage /// </summary> /// <param name="logTimerType"></param> /// <param name="syncUi"></param> private void SyncRequestResponseStorage(string logTimerType, Action SyncUi, bool SaveWithSameHash) { if (string.IsNullOrEmpty(ShAppContext.UserId)) { return; } ReqSyncDTO SyncDTO = ListsManager.Instance.GenerateRequestDTOForSync(ShAppContext.UserId, ShAppContext.UserLogin); Task <string> resSync = HelperFactory.GetHttpHelper().HttpPut <ReqSyncDTO>(SyncDTO, Constants.URL_SYNC, ShAppContext.UserToken); string sResJson = resSync.Result; Log.Debug(logTimerType, "Send request server DTO"); ResSyncDTO ResSync = null; try { ResSync = JsonConvert.DeserializeObject <ResSyncDTO>(sResJson); Log.Debug(logTimerType, "OK response from server"); } catch (Exception) { ResSync = new ResSyncDTO(); Log.Debug(logTimerType, "Exception deserialize response from server"); } string newhash = Guid.NewGuid().ToString(); if (ResSync.ErrorCode == 0) { newhash = Tools.GetMd5Hash(sResJson); if (newhash != ListsManager.Instance.CurrentJsonHash && SyncUi != null) { ListsManager.Instance.ImportSyncData(newhash, ResSync); SyncUi(); }//endif Log.Debug(logTimerType, "Sync OK"); } else { Log.Debug(logTimerType, "Error response from server - NOT sync"); } if ((SaveWithSameHash && newhash == ListsManager.Instance.CurrentJsonHash) || (newhash != ListsManager.Instance.CurrentJsonHash)) { string sJson = ListsManager.Instance.GetSerializedDataForLocalStorage(); FilesManager.WriteShListsState(sJson); Log.Debug(logTimerType, "Save in file the changes"); } //endif } //SyncRequestResponseStorage
/// <summary> /// 取得反馈类型名称 /// </summary> /// <param name="typeID"></param> /// <returns></returns> protected string GetAdviceTypeName(string typeID) { if (String.IsNullOrEmpty(typeID)) { return("当前类型不存在"); } if (!dicTypeNames.ContainsKey(typeID)) { AdviceType type = HelperFactory.GetHelper <AdviceTypeHelper>().GetAdviceType(typeID); dicTypeNames.Add(typeID, typeID != null ? type.Title : String.Empty); } return(dicTypeNames[typeID]); }
protected void CreateControlIndex_Click(object sender, EventArgs e) { try { DataControlHelper dchelper = HelperFactory.GetHelper <DataControlHelper>(); dchelper.CreateDataControlIndex(); //BaseControlHelper Helper = new BaseControlHelper(); //Helper.CreateIntegrationIndexConfig(); Messages.ShowMessage("重新索引成功"); } catch (Exception ex) { Messages.ShowError("重建索引失败:" + ex.Message); } }
protected override void OnLoad(System.EventArgs e) { if (Page != null && Page.Master != null && Page.Master.Master != null) { var baseMaster = ((_BaseMaster)Page.Master.Master); ((WebMessageHelper)HelperFactory.MessageHelper).MessageUC = baseMaster.MessageUC; baseMaster.ProgressUC.TaskID = ((WebBackgroundWorkerHelper2)HelperFactory.GetBackgroundWorkerHelper()).TaskID = Guid.NewGuid(); // ((WebBackgroundWorkerHelper) HelperFactory.GetBackgroundWorkerHelper()).ProgressUC = // baseMaster.ProgressUC; } base.OnLoad(e); }
string GetContentUrl(Article a) { if (!String.IsNullOrEmpty(a.ChannelFullUrl)) { return(a.ChannelFullUrl + a.FullUrl); } else { List <Channel> chs = HelperFactory.GetHelper <ChannelHelper>().GetChannelByModelName(a.ModelName); if (chs != null && chs.Count > 0) { return(chs[0].RealUrl + We7Helper.GUIDToFormatString(a.ID) + "." + GeneralConfigs.GetConfig().UrlFormat); } } return(We7Helper.GUIDToFormatString(a.ID) + "." + GeneralConfigs.GetConfig().UrlFormat); }
public static void ResetApplication() { lock (lockHelper) { HttpContext context = HttpContext.Current; context.Application.Clear(); if (context.Session != null) { context.Session.Clear(); } BaseConfigs.ResetConfig(); SiteConfigs.ResetConfig(); GeneralConfigs.ResetConfig(); context.Application["We7.Application.OnlinePeople.Key"] = 0; if (BaseConfigs.ConfigFileExist()) { BaseConfigInfo baseconfig = BaseConfigs.GetBaseConfig(); string root = context.Server.MapPath("~/"); string dataPath = context.Server.MapPath("~/App_Data/XML"); ObjectAssistant assistant = new ObjectAssistant(); try { if (baseconfig != null && baseconfig.DBConnectionString != "") { baseconfig.DBConnectionString = baseconfig.DBConnectionString.Replace("{$App}", AppDomain.CurrentDomain.BaseDirectory).Replace("\\\\", "\\"); assistant.LoadDBConnectionString(baseconfig.DBConnectionString, baseconfig.DBDriver); } assistant.LoadDataSource(dataPath); } catch (DataException ex) { Debug.WriteLine(ex.ToString()); string s = string.Format("注意检查:/app_data/xml目录下的配置文件:\r\n错误代码:{0}\r\n错误消息:{1}", ex.Errorcode, ex.Message); LogHelper.WriteLog(typeof(ApplicationHelper), s); throw ex; } HelperFactory factory = new HelperFactory(); factory.Assistant = assistant; factory.Root = root; factory.Initialize(); context.Application["We7.HelperFactory"] = factory; } } }
void SingleTableLinkTo(PanelContext data, We7DataTable dt, string id) { if (DbHelper.CheckTableExits(data.Table.Name)) { DataTable datatables = DbHelper.Query(String.Format("SELECT * FROM [{0}] WHERE [ID]='{1}'", data.Table.Name, id)); if (datatables.Rows.Count > 0) { DataRow row = datatables.Rows[0]; We7DataColumn dc1 = dt.Columns.IndexOfMappingField("ContentUrl"); We7DataColumn dc2 = data.Table.Columns.IndexOfMappingField("OwnerID"); if (dc1 != null && dc2 != null) { StringBuilder sbFields = new StringBuilder(); StringBuilder sbValues = new StringBuilder(); sbFields.Append("[ID],"); sbValues.Append("'" + We7Helper.CreateNewID() + "',"); Channel ch = HelperFactory.GetHelper <ChannelHelper>().GetChannel(row[dc2.Name].ToString(), null); sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("{0},", String.Format("{0}{1}.{2}", ch.FullUrl, We7Helper.GUIDToFormatString(row["ID"].ToString()), GeneralConfigs.GetConfig().UrlFormat)); dc1 = dt.Columns.IndexOfMappingField("Title"); dc2 = data.Table.Columns.IndexOfMappingField("Title"); if (dc1 != null && dc2 != null) { sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("'{0}',", row[dc2.Name]); } dc1 = dt.Columns.IndexOfMappingField("ContentType"); dc2 = data.Table.Columns.IndexOfMappingField("ContentType"); if (dc1 != null && dc2 != null) { sbFields.AppendFormat("[{0}],", dc1.Name); sbValues.AppendFormat("{0},", (int)TypeOfArticle.LinkArticle); } Utils.TrimEndStringBuilder(sbFields, ","); Utils.TrimEndStringBuilder(sbValues, ","); string sql = String.Format("INSERT INTO [{0}]({1}) VALUES({2})", dt.Name, sbFields, sbValues); DbHelper.ExecuteSql(sql); } } } }
/// <summary> /// writing message on end of target logging text file /// </summary> /// <param name="o"></param> private static void FileUpdate(string newLine) { EPath epath = HelperFactory.GetModuleByType <EPath>(); /* Lastest */ string[] currentLastest = File.ReadAllLines(Path.Combine(epath._ApplicationConfigPath(), EPath.ApplicationData, EPath.ApplicationLog, "Lastest log.txt")); List <string> _currentLastest = new List <string>(currentLastest); _currentLastest.Add(newLine); File.WriteAllLines(Path.Combine(epath._ApplicationConfigPath(), EPath.ApplicationData, EPath.ApplicationLog, "Lastest log.txt"), _currentLastest.ToArray()); /* Datetime */ if (File.Exists(Path.Combine(epath._ApplicationConfigPath(), EPath.ApplicationData, EPath.ApplicationLog, Filename))) { File.Delete(Path.Combine(epath._ApplicationConfigPath(), EPath.ApplicationData, EPath.ApplicationLog, Filename)); } File.WriteAllLines(Path.Combine(epath._ApplicationConfigPath(), EPath.ApplicationData, EPath.ApplicationLog, Filename), Message); }
/// <summary> /// Asserts that a ControllerActionExpression maps to a specified url. /// </summary> /// <param name="expectedUrl">The expected url</param> /// <param name="because"> /// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion /// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically. /// </param> /// <param name="reasonArgs"> /// Zero or more objects to format using the placeholders in <see cref="because" />. /// </param> public AndConstraint <ControllerActionExpressionAssertions <TController> > MapToUrl(string expectedUrl, string because = "", params object[] reasonArgs) { var generatedUrl = Subject.RouteContext().GetUrl(HelperFactory.UrlHelper()); var isMatchingUrl = string.Compare(generatedUrl, expectedUrl, StringComparison.InvariantCultureIgnoreCase) == 0; Execute.Assertion .BecauseOf(because, reasonArgs) .ForCondition(isMatchingUrl) .FailWith("Expected {context:outboundurl} to resolve Url to {0}{reason}, but found {1}.", expectedUrl, generatedUrl); return(new AndConstraint <ControllerActionExpressionAssertions <TController> >(this)); }
protected void BindData() { chkModules.DataSource = HelperFactory.GetHelper <ChannelModuleHelper>().GetAllModule(); chkModules.DataTextField = "Title"; chkModules.DataValueField = "ID"; chkModules.DataBind(); List <ChannelModuleMapping> mapping = HelperFactory.GetHelper <ChannelModuleHelper>().GetMappingByChannelID(ChannelID); foreach (ListItem item in chkModules.Items) { foreach (ChannelModuleMapping m in mapping) { if (item.Value == m.ModuleID) { item.Selected = true; } } } }
public string GetDefaultTemplatePath(string templateAlias, bool isDetail) { HelperFactory helperFactory = (HelperFactory)HttpContext.Current.Application[HelperFactory.ApplicationID]; SiteSettingHelper cdHelper = helperFactory.GetHelper <SiteSettingHelper>(); GeneralConfigInfo si = GeneralConfigs.GetConfig(); if (si.DefaultTemplateGroupFileName != null && si.DefaultTemplateGroupFileName.Length > 0) { TemplateGroup tg = GetTemplateGroupCache(si.DefaultTemplateGroupFileName); string DefaultTemplatePath = ""; foreach (TemplateGroup.Item it in tg.Items) { if (it.Alias == templateAlias && it.IsDetailTemplate == isDetail) { DefaultTemplatePath = it.Template; break; } } if (DefaultTemplatePath != "") { if (EnableSiteSkins) { DefaultTemplatePath = String.Format("{0}/{1}", Path.GetFileNameWithoutExtension(si.DefaultTemplateGroupFileName), DefaultTemplatePath); } return(GetTemplatePath(DefaultTemplatePath)); } else { return(""); } } else { return(""); } }
public CategoryCrudPresenter(ICategoryCrudView view) : base(view) { Bo.ProgressReported += Bo_ProgressReported; backgroundWorker = HelperFactory.GetBackgroundWorkerHelper(); backgroundWorker.SuportsCancellation = Bo.SupportsCancellation; backgroundWorker.WorkerCanceled += BackgroundWorkerHelper_WorkerCanceled; backgroundWorker.WorkerError += BackgroundWorkerHelper_WorkerError; backgroundWorker.WorkerCompleted += BackgroundWorkerHelper_WorkerCompleted; // HelperFactory.BackgroundWorkerHelper.DoWorkDelegate += SlowWork; To.SlowWorkTime = view.SlowWorkTime; if (view is IWebControl && ((IWebControl)view).IsPostBack) { FindAll(); } else { FindAllDataBind(); } }
/// <summary> /// 重启应用程序 /// </summary> public static void LoadHelperFactory() { lock (lockHelper2) { //如果数据库配置文件存在,加载配置 if (BaseConfigs.ConfigFileExist()) { BaseConfigInfo baseconfig = BaseConfigs.GetBaseConfig(); //加载数据库映射表 string root = AppDomain.CurrentDomain.BaseDirectory; string dataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data/XML"); ObjectAssistant assistat = new ObjectAssistant(); try { if (baseconfig != null && baseconfig.DBConnectionString != "") { baseconfig.DBConnectionString = baseconfig.DBConnectionString.Replace("{$App}", AppDomain.CurrentDomain.BaseDirectory); assistat.LoadDBConnectionString(baseconfig.DBConnectionString, baseconfig.DBDriver); } assistat.LoadDataSource(dataPath); } catch (Thinkment.Data.DataException ex) { Debug.WriteLine(ex.ToString()); string source = "CD.Utils_CDHelper_ResetApplication"; EventLogHelper.WriteToLog(source, ex, EventLogEntryType.Error); throw ex; } HelperFactory hf = new HelperFactory(); hf.Assistant = assistat; hf.Root = root; hf.Initialize(); AppCtx.Cache.AddObject(HelperFactory.CacheKey, hf); } } }
void DataGridView_RowCommand(object sender, GridViewCommandEventArgs e) { string cmd = e.CommandName; if (String.Compare(cmd, "ed", true) == 0) { Response.Redirect("CategoryEdit.aspx?typeId=" + TypeID + "&id=" + e.CommandArgument); } else if (String.Compare(cmd, "del", true) == 0) { try { HelperFactory.GetHelper <CategoryHelper>().DeleteCategory(e.CommandArgument as string); DataBind(); Messages.ShowMessage("操作成功!"); } catch (Exception ex) { Messages.ShowError("删除失败:" + ex.Message); } } }
protected void Page_Load(object sender, EventArgs e) { HelperFactory helperFactory = HelperFactory.Instance; TemplateHelper TemplateHelper = helperFactory.GetHelper <TemplateHelper>(); string editorUrl = "/admin/DataControlUI/Compose.aspx"; if (GeneralConfigs.GetConfig().DefaultTemplateEditor == "1") { editorUrl = "/admin/VisualTemplate/TemplateCreate.aspx"; } string bindName = string.Format("handler={0}&mode={1}&model={2}", BindConfig.Handler, BindConfig.Mode, BindConfig.Model); string urlCompose = string.Format("{0}?{1}", editorUrl, bindName); TitleLabel.Text = "没有匹配的" + BindConfig.ModelText + BindConfig.Description + "模板"; ActionLiteral.Text = string.Format("<a href='{0}' target='_blank'>创建{1}(模板)</a>", urlCompose, BindConfig.ModelText + BindConfig.Description); if (string.IsNullOrEmpty(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName) || !Directory.Exists(TemplateHelper.DefaultTemplateGroupPath)) { HelpLiteral.Text = "您也可以到微七插件商场下载一套完整模板。<a href='http://m.we7.cn' target='_blank'>去下载</a>"; TemplateGroup[] tg = TemplateHelper.GetTemplateGroups(null); int count = tg.Length; if (count > 0) { string urlSelectTemplate = "/admin/TemplateGroups.aspx"; HelpLiteral.Text += string.Format("<br>本地有{0}套可用模板组,您没有选用,要选用一个吗?<a href='{1}' target='_blank'>选一个</a>", count.ToString(), urlSelectTemplate); } } else { Template[] tps = TemplateHelper.GetTemplates(null, Path.GetFileNameWithoutExtension(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName)); if (tps.Length > 0) { string urlBindTemplate = string.Format("/admin/Template/TemplateGroupEdit.aspx?file={0}&tab=3", GeneralConfigs.GetConfig().DefaultTemplateGroupFileName); HelpLiteral.Text = string.Format("您已经创建了{0}个模板页了,是否已经创建本页模板但尚未指定?<a href='{1}' target='_blank'>去看一下</a>", tps.Length, urlBindTemplate); } } }
/// <summary> /// 获取广告位的JS文件路径 /// </summary> /// <param name="siteID">站点ID</param> /// <param name="url">站点Url</param> /// <param name="tag">页面标签</param> /// <returns></returns> public string GetADZoneJSPath(string siteID, string url, string app, string tag) { try { ChannelHelper chHelper = HelperFactory.GetHelper <ChannelHelper>(); url = url.ToLower(); string chID = chHelper.GetChannelIDFromURL(); string channelPath = chHelper.GetFullPath(chID); string pathType = ""; //路径类型:"*"首页与栏目;"*.html"内容页;"*.aspx"其他页 if ((url.EndsWith("_") && !url.EndsWith("aspx_")) || url.EndsWith("_default.aspx") || url.EndsWith("_default.html") || url.EndsWith("_index.html")) { pathType = "*"; } if (url.EndsWith(".html") && !url.EndsWith("default.html")) { pathType = "*.html"; } if ((url.EndsWith(".aspx") && !url.EndsWith("default.aspx")) || url.EndsWith(".aspx_")) { pathType = "*.aspx"; channelPath = "";//如果为其他页,则此路径为空 } return(GetADService().GetAdZoneJSPath(siteID, channelPath, pathType, tag)); } catch (SoapException soapExt) { throw new Exception(We7Helper.SoapExceptionInfo(soapExt)); } catch (Exception ex) { throw ex; } }
public void UserFactory_Override() { int callCount = 0; var source = new TestClass1(); HelperFactory <TestClass1> helperFactory = new HelperFactory <TestClass1>() { MyFunc = (x, y) => { callCount++; return(source); } }; CloneConfig.Factories = new List <ICloneDelFactory> { helperFactory }; var target = source.GetClone(); Assert.Same(source, target); Assert.Equal(1, callCount); }