private void CompanyDescription_D_Test() { var client = new CompanyDescription.CompanyDescriptionClient(_channel); CompanyDescriptionProto proto = client.GetCompanyDescription(new CompanyDescriptionKey() { Id = _companyDescription.Id.ToString() }); CompanyDescriptionList protos = new CompanyDescriptionList(); protos.Items.Add(proto); client.DeleteCompanyDescription(protos); proto = null; try { proto = client.GetCompanyDescription(new CompanyDescriptionKey() { Id = _companyDescription.Id.ToString() }); } catch (RpcException) { } Assert.IsNull(proto); }
private void CompanyDescription_CRU_Test() { var client = new CompanyDescription.CompanyDescriptionClient(_channel); // add CompanyDescriptionProto proto = ProtoMapper.MapFromCompanyDescriptionPoco(_companyDescription); CompanyDescriptionList protos = new CompanyDescriptionList(); protos.Items.Add(proto); client.AddCompanyDescription(protos); proto = CheckGetCompanyDescription(client, new CompanyDescriptionKey() { Id = proto.Id }, proto); // check List protos = client.GetCompanyDescriptions(new Empty()); Assert.IsTrue(protos.Items.Count > 0); // check update proto.CompanyDescription = Truncate(Faker.Lorem.Paragraph(), 500); proto.CompanyName = Truncate(Faker.Lorem.Sentence(), 50); protos = new CompanyDescriptionList(); protos.Items.Add(proto); client.UpdateCompanyDescription(protos); CheckGetCompanyDescription(client, new CompanyDescriptionKey() { Id = proto.Id }, proto); }
public override Task <Empty> DeleteCompanyDescription(CompanyDescriptionList request, ServerCallContext context) { List <CompanyDescriptionPoco> pocos = new List <CompanyDescriptionPoco>(); foreach (var item in request.CompDescList) { pocos.Add(ToPoco(item)); } logic.Delete(pocos.ToArray()); return(Task.FromResult(new Empty())); }
public override Task <CompanyDescriptionList> GetAllCompanyDescription(Empty request, ServerCallContext context) { CompanyDescriptionList list = new CompanyDescriptionList(); List <CompanyDescriptionPoco> pocos = logic.GetAll(); foreach (var poco in pocos) { list.CompDescList.Add(FromPoco(poco)); } return(Task.FromResult(list)); }