private void SystemLanguageCode_D_Test()
        {
            var client = new SystemLanguageCode.SystemLanguageCodeClient(_channel);

            SystemLanguageCodeProto proto = client.GetSystemLanguageCode(new SystemLanguageCodeKey()
            {
                LanguageID = _systemLangCode.LanguageID
            });
            SystemLanguageCodeList protos = new SystemLanguageCodeList();

            protos.Items.Add(proto);
            client.DeleteSystemLanguageCode(protos);
            proto = null;
            try
            {
                proto = client.GetSystemLanguageCode(new SystemLanguageCodeKey()
                {
                    LanguageID = _systemLangCode.LanguageID
                });
            }
            catch (RpcException)
            {
            }
            Assert.IsNull(proto);
        }
        private void SystemLanguageCode_CRU_Test()
        {
            var client = new SystemLanguageCode.SystemLanguageCodeClient(_channel);
            // add
            SystemLanguageCodeProto proto  = ProtoMapper.MapFromSystemLanguageCodePoco(_systemLangCode);
            SystemLanguageCodeList  protos = new SystemLanguageCodeList();

            protos.Items.Add(proto);
            client.AddSystemLanguageCode(protos);

            CheckGetSystemLanguageCode(client, new SystemLanguageCodeKey()
            {
                LanguageID = proto.LanguageID
            }, proto);

            // check List
            protos = client.GetSystemLanguageCodes(new Empty());
            Assert.IsTrue(protos.Items.Count > 0);

            // check update
            proto.Name       = Truncate(Faker.Lorem.Sentence(), 50);
            proto.NativeName = Truncate(Faker.Lorem.Sentence(), 50);

            protos = new SystemLanguageCodeList();
            protos.Items.Add(proto);
            client.UpdateSystemLanguageCode(protos);

            CheckGetSystemLanguageCode(client, new SystemLanguageCodeKey()
            {
                LanguageID = proto.LanguageID
            }, proto);
        }
Beispiel #3
0
        public override Task <Empty> DeleteSystemLanguageCode(SystemLanguageCodeList request, ServerCallContext context)
        {
            List <SystemLanguageCodePoco> pocos = new List <SystemLanguageCodePoco>();

            foreach (var item in request.SystemLangCodes)
            {
                pocos.Add(ToPoco(item));
            }
            logic.Delete(pocos.ToArray());
            return(Task.FromResult(new Empty()));
        }
Beispiel #4
0
        public override Task <SystemLanguageCodeList> GetAllSystemLanguageCode(Empty request, ServerCallContext context)
        {
            SystemLanguageCodeList        list  = new SystemLanguageCodeList();
            List <SystemLanguageCodePoco> pocos = logic.GetAll();

            foreach (var poco in pocos)
            {
                list.SystemLangCodes.Add(FromPoco(poco));
            }
            return(Task.FromResult(list));
        }