[Route("Member/Get/{Id}")] public JsonResult GetMemberList(long Id, string cc = "f") { var cleanCache = false; //// logics here if (this.IsFromCompany() && cc == "t") { //// do something ... }
try { var memberList = this.memberService.GetMemberList(Id, cleanCache); //// logics here if (memberList.Any()) { //// do something ... } else { //// do something ... }
returnthis.Json(result, JsonRequestBehavior.AllowGet); } catch (Exception ex) { //// logics here //// do something ... } }
public ActionResult Index() { returnthis.Service.GetIndex(); }
Q3 當 Service 只有取資料的邏輯
No Logics in Service
1 2 3 4
public Member Get(long id) { returnthis.DataAccessor.GetMember(id); }
Q3.自問自答
我認為不要, 要測試商業邏輯,不要在意覆蓋率
Q4. 當 Service 只有取 Catch 資料的邏輯
No Logics in Service , just call another service
1 2 3 4 5 6 7 8 9 10 11
public Member Get(long id) { var enableCache = true; var result = this.CacheService.GetCacheData( cacheKey, () => { returnthis.DataAccessor.GetMember(id); }, enableCache ); }
public Member Get(long id) { var enableCache = true; var result = this.CacheService.GetCacheData( cacheKey, () => { //// logics here if(id > 9487) { returnthis.MemberAccessor.GetMember(id); }else { returnthis.MemberV2Accessor.GetMember(id); }
上略... using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { using (Entities context = Entities.CreateNew(isReadOnly: true)) { //// logics here var query = from a in context.Activies.Valids() where a.Activies_StartDateTime <= startTime && a.Activies_EndDateTime >= now && a.Activies_ShopId == shopId && a.ActiviesCondition.Any(i => i.Activies_ValidFlag && TypeList.Contains(i.Activies_TypeDef)) select a; } }
client_secret.json 是機敏資料, 不可以放入版本控制, 需要特殊的流程步驟上傳到你的 Web Server 的位置 - Openshift 可以透過 SSH 或是 SFTP 登入來上傳client_secret.json - CI 以 JENKINS 為例 ; 可以使用 Publish over SSH 上傳檔案 - 需要注意 CI Server 要有 Web Server 的 SSH Key - LINUX 複製資料夾語法 cp -rf src/folder/. target/folder