コード例 #1
0
        public void AuthorsFileDifferentIdsForUsersWithSameEmail()
        {
            string[] authors =
            {
                @"Domain\Test.User = Test User <*****@*****.**>",
                @"Domain\Different.User = Three Name User < *****@*****.** >",
                @"Domain\Yet.Another.User = Mr. 3 <*****@*****.**>"
            };

            AuthorsFile authFile = _SetupAuthorsFile(authors);

            Assert.NotNull(authFile.AuthorsByGitUserId);

            // multiple users with the same email -> 3 tfs users, 1 git user
            Assert.Equal <int>(authors.Length, authFile.Authors.Count);
            Assert.Single(authFile.AuthorsByGitUserId);

            // contains all tfs users
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Test.User"));
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Different.User"));
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Yet.Another.User"));

            // contains all git users
            Assert.True(authFile.AuthorsByGitUserId.ContainsKey(Author.BuildGitUserId("*****@*****.**")));

            // return the first tfs user id in the authors file when multiple
            // match to the same git id.
            Tuple <string, string> git_author = new Tuple <string, string>("Test User", "*****@*****.**");
            Author a = authFile.FindAuthor(git_author);

            Assert.NotNull(a);
            Assert.Equal(@"Domain\Test.User", a.TfsUserId);
        }
コード例 #2
0
        public void AuthorsFileMultipleUsers()
        {
            string[] authors =
            {
                @"Domain\Test.User = Test User <*****@*****.**>",
                @"Domain\Different.User = Three Name User < *****@*****.** >",
                @"Domain\Yet.Another.User = Mr. 3 <*****@*****.**>"
            };

            AuthorsFile authFile = _SetupAuthorsFile(authors);

            Assert.Equal <int>(authors.Length, authFile.Authors.Count);
            Assert.Equal <int>(authors.Length, authFile.AuthorsByGitUserId.Count);

            // contains all tfs users
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Test.User"));
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Different.User"));
            Assert.True(authFile.Authors.ContainsKey(@"Domain\Yet.Another.User"));

            // contains all git users
            Assert.True(authFile.AuthorsByGitUserId.ContainsKey(Author.BuildGitUserId("*****@*****.**")));
            Assert.True(authFile.AuthorsByGitUserId.ContainsKey(Author.BuildGitUserId("*****@*****.**")));
            Assert.True(authFile.AuthorsByGitUserId.ContainsKey(Author.BuildGitUserId("*****@*****.**")));
        }