Пример #1
0
        public void CreateUser2()
        {
            var axlClient = new AxlClient(new UcClientSettings {
                Server = "10.10.20.1", User = "******", Password = "******"
            });

            var appresult = axlClient.Execute(client =>
            {
                var res = client.getAppUser(new GetAppUserReq
                {
                    ItemElementName = ItemChoiceType102.userid,
                    Item            = "administrator"
                });
                return(res.@return);
            });

            Assert.IsNull(appresult.Exception);

            var addUserResult = axlClient.Execute(async client =>
            {
                var userId  = Guid.NewGuid().ToString();
                var request = new AddUserReq
                {
                    user = new XUser
                    {
                        userid       = userId,
                        userIdentity = userId,
                        password     = "******",
                        firstName    = "test",
                        lastName     = "test"
                    }
                };
                var response = await client.addUserAsync(request);
                return(response.addUserResponse1.@return);
            });

            Assert.IsNull(addUserResult.Exception);

            var users = axlClient.Execute(client =>
            {
                var request = new ListUserReq
                {
                    returnedTags = new LUser {
                        firstName = string.Empty
                    },
                    searchCriteria = new ListUserReqSearchCriteria {
                        firstName = "%"
                    }
                };
                var response = client.listUser(request);
                return([email protected](u => u.firstName).ToList());
            });

            Assert.IsTrue(users.Value.Any());
        }
Пример #2
0
        public async Task CreateUser()
        {
            var axlClient = new AxlClient(new UcClientSettings {
                Server = "10.10.20.1", User = "******", Password = "******"
            });

            var addUserResult = await axlClient.ExecuteAsync(async client =>
            {
                var userId  = Guid.NewGuid().ToString();
                var request = new AddUserReq
                {
                    user = new XUser
                    {
                        userid       = userId,
                        userIdentity = userId,
                        password     = "******",
                        firstName    = "test",
                        lastName     = "test"
                    }
                };
                var response = await client.addUserAsync(request);
                return(response.addUserResponse1.@return);
            });

            Assert.Inconclusive(addUserResult.Exception.Message);
            Assert.IsNull(addUserResult.Exception);

            var users = await axlClient.ExecuteAsync(async client =>
            {
                var request = new ListUserReq
                {
                    returnedTags = new LUser {
                        firstName = string.Empty
                    },
                    searchCriteria = new ListUserReqSearchCriteria {
                        firstName = "%"
                    }
                };
                var response = await client.listUserAsync(request);
                return([email protected](u => u.firstName).ToList());
            });

            Assert.IsTrue(users.Value.Any());
        }