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);
        }
        private CompanyDescriptionProto CheckGetCompanyDescription(CompanyDescription.CompanyDescriptionClient client
                                                                   , CompanyDescriptionKey key, CompanyDescriptionProto compare = null)
        {
            CompanyDescriptionProto proto = null;

            try
            {
                proto = client.GetCompanyDescription(key);
            }
            catch (RpcException)
            {
                Assert.Fail();
            }
            Assert.IsNotNull(proto);
            Assert.AreEqual(proto.Id, key.Id);
            if (compare != null)
            {
                Assert.AreEqual(proto.Company, compare.Company);
                Assert.AreEqual(proto.LanguageId, compare.LanguageId);
                Assert.AreEqual(proto.CompanyName, compare.CompanyName);
                Assert.AreEqual(proto.CompanyDescription, compare.CompanyDescription);
            }
            return(proto);
        }