public void GetAllFolksFolksBusinessLayerTest() { FolksBusinessManager folksBusinessManager = new FolksBusinessManager(); List <FolksModel> folks = folksBusinessManager.GetAllFolks(); Assert.IsTrue(folks != null); Assert.IsTrue(folks.Count > 0); }
// // GET: /Home/ #endregion constructors #region action methods public virtual ActionResult Index() { //no try catch because we are relying on the [HandleError] OnException handling //customerrors in config set to "on", but no error page exists yet, did not create one List <FolksModel> allFolksReturn = new List <FolksModel>(); #region implementation with the wcf service commented out /* * bool success = false; * * GenericList<FolksModel> genericList = new CommonLibrary.Utilty.Sort.GenericList<FolksModel>(); * * //implementation using the WCF Service - do not use using block, best practice check underlying connecton * //state, sometimes using block fails to close connection successfully to use this: remove reference to * //data contracts project directly and Add the FolksService.cs class in the Models directory * //back into include in the project'you will need to change namespace from DataContracts to famousfolks.com * * try * { * FolksServiceClient client = new FolksServiceClient(); * * FolksModel[] allFolks = client.GetAllFolks(); * * genericList.AddRange(allFolks); * genericList.Sort("LastName", CollectionSortDirection.Ascending); * return View(genericList); * * } * catch (TimeoutException te) * { * _log.Fatal(te); * * } * catch (FaultException fe) * { * _log.Fatal(fe); * * } * catch (CommunicationException ce) * { * _log.Fatal(ce); * } * * catch (Exception ex) * { * * _log.Fatal(ex); * } * * finally * { * if (client != null) * { * client.CloseProxy(); * } * } * * if (!success) * { * throw new ApplicationException("Exception Loading FolksModel from Service Layer"); * } * */ #endregion implementation with the wcf service commented out #region implemented using business layer directly for simplicity FolksBusinessManager businessManager = new FolksBusinessManager(); allFolksReturn = businessManager.GetAllFolks(); GenericList <FolksModel> genericList = new CommonLibrary.Utilty.Sort.GenericList <FolksModel>(); genericList.AddRange(allFolksReturn); genericList.Sort("LastName", CollectionSortDirection.Ascending); return(View(genericList)); #endregion implemented using business layer directly }
public List <FolksModel> GetAllFolks() { FolksBusinessManager folksBusinessManager = new FolksBusinessManager(); return(folksBusinessManager.GetAllFolks()); }