示例#1
0
        public void SearchGitLabUser()
        {
            GitLabWrapper wrapper = new GitLabWrapper(TestCredentials.GitServer, TestCredentials.GitLabToken);
            var           dict    = wrapper.GetUsers().ToDictionary(x => x.Username);
            var           user    = dict["Litvinov"];

            Assert.IsNotNull(user.Email);
        }
示例#2
0
        IEnumerable <User> CreateGitLabUsers()
        {
            var gitlabUsers = gitLabWrapper.GetUsers();

            foreach (var gitLabUser in gitlabUsers)
            {
                if (CalcIsKnownUser(gitLabUser))
                {
                    yield return(new User(gitLabUser.Username, GetEmail(gitLabUser.Username), gitLabUser.Name, true));
                }
                else if (CalcIsRenamedUser(gitLabUser))
                {
                    var adUser      = ADUsers.Values.First(x => x.Email == gitLabUser.Email);
                    var renamedUser = this.gitLabWrapper.RenameUser(gitLabUser, adUser.UserName, adUser.DisplayName, adUser.Email);
                    yield return(new User(renamedUser.Username, GetEmail(renamedUser.Username), renamedUser.Name, true));
                }
                else
                {
                    yield return(new User(gitLabUser.Username, GetEmail(gitLabUser.Username), gitLabUser.Name, true));
                }
            }
        }