如何获得Microsoft.TeamFoundation.Framework.Client.TeamFoundation

本文关键字:TeamFoundation Framework Client Microsoft 何获得 | 更新日期: 2023-09-27 18:04:24

我正试图使一个实用程序与TFS工作,我从testcase得到所有者值,并想改变它:

var gss = Connection.ProjectCollection.GetService<IGroupSecurityService>();
Identity validUserSids = gss.ReadIdentity(SearchFactor.AccountName, "Team Foundation Valid Users", QueryMembership.Expanded);
Identity[] validUsers = gss.ReadIdentities(SearchFactor.Sid, validUserSids.Members, QueryMembership.None);
var owner = validUsers.FirstOrDefault(x => x != null && AccountName == "MyAccountName");

但是当我尝试在testCase.Owner中设置owner时,我得到一个错误:Cannot conver type "Microsoft.TeamFoundation.Server.Identity" to type "Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity", cast也给出了一个错误。

如何让Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity集合设置字段testCase.Owner中的值?

如何获得Microsoft.TeamFoundation.Framework.Client.TeamFoundation

您需要使用ITestBase。业主物业接口

TeamFoundationIdentity Owner { get; set; }

如以下代码:

  public static ITestCase CreateTestCase(ITestManagementTeamProject project, string title, string desc = "", TeamFoundationIdentity owner = null)
    {
        // Create a test case.
        ITestCase testCase = project.TestCases.Create();
        testCase.Owner = owner;
        testCase.Title = title;
        testCase.Description = desc;
        testCase.Save();
        return testCase;
    }
>