/// <summary> /// Gets all member ListView model. /// </summary> /// <param name="selectModel">The select model.</param> /// <returns></returns> private IEnumerable <MemberListContentViewModel> GetAllMemberListViewModel(MemberListHeaderViewModel selectModel) { // 取得子功能 IEnumerable <ZipCode> zipcode = _ZipCodeRep.GetAll(); IEnumerable <Member> members = _MemberRep.GetAll(); IEnumerable <MemberListContentViewModel> result = members.Join(zipcode, s => s.ZipCodeID, z => z.ID, (s, z) => new { s, z }) .Where(x => (!string.IsNullOrEmpty(selectModel.Name) ? x.s.Name.Contains(selectModel.Name) : true) && (!string.IsNullOrWhiteSpace(selectModel.PhoneNumber.ToString()) ? x.s.PhoneNumber.ToString().Contains(selectModel.PhoneNumber.ToString()) : true)) .Select(List => new MemberListContentViewModel() { MemberID = List.s.MemberID, CreateTime = List.s.CreateTime.ToString(), Name = List.s.Name, //Sex = List.Sex.ToString(), PhoneNumber = List.s.PhoneNumber, District = List.z.City + " " + List.z.County }).OrderByDescending(s => s.CreateTime).ToList(); List <MemberListContentViewModel> a = result.ToList(); return(result); }
public void RemoveTest() { IZipCodeRepository r = new ZipCodeRepository(); var list = r.GetAll().GetEnumerator(); list.MoveNext(); Empresa item = new Empresa() { Nome = "company01", CNPJ = "12345678901234", InscricaoEstadual = "Isento", Complemento = "Ao lado do mercado", Numero = 10, Cep = list.Current }; ICompanyRepository target = new CompanyRepository(); target.Add(item); target.Remove(item); // use session to try to load the product using (ISession session = NHibernateHelper.OpenSession()) { var fromDb = session.Get <Empresa>(item.Id); Assert.IsNull(fromDb); Assert.AreNotSame(item, fromDb); } }
public void GetAllTest() { IZipCodeRepository target = new ZipCodeRepository(); var list = target.GetAll(); foreach (var fromDb in list) { Assert.IsNotNull(fromDb); Assert.IsNotNull(fromDb.Cidade); Assert.IsNotNull(fromDb.Cidade.Nome); } }
public static void MyClassInitialize(TestContext testContext) { IZipCodeRepository r = new ZipCodeRepository(); var list = r.GetAll().GetEnumerator(); list.MoveNext(); item = new Empresa() { Nome = "company", CNPJ = "12345678901234", InscricaoEstadual = "Isento", Complemento = "Ao lado do mercado", Numero = 10, Cep = list.Current }; ICompanyRepository target = new CompanyRepository(); target.Add(item); }