本文整理汇总了C#中WorkItem.SyncToLatest方法的典型用法代码示例。如果您正苦于以下问题:C# WorkItem.SyncToLatest方法的具体用法?C# WorkItem.SyncToLatest怎么用?C# WorkItem.SyncToLatest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorkItem
的用法示例。
在下文中一共展示了WorkItem.SyncToLatest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewTask_succeeds
public void NewTask_succeeds()
{
// prepare
this.fixture.PushPolicies("NewObjects");
string workItemTypeName = "Bug";
var targetType = this.fixture.Project.WorkItemTypes[workItemTypeName];
var wiBug = new WorkItem(targetType);
wiBug.Title = workItemTypeName + " NewLink_succeeds";
// trigger
wiBug.Save();
Thread.Sleep(4000);
wiBug.SyncToLatest();
// validate
var hierarchyRelationship = this.fixture.WorkItemStore.WorkItemLinkTypes["System.LinkTypes.Hierarchy"];
Assert.Equal(1, wiBug.WorkItemLinks.Count);
var actualLink = wiBug.WorkItemLinks[0];
Assert.Equal(hierarchyRelationship.ForwardEnd.ImmutableName, actualLink.LinkTypeEnd.ImmutableName);
Assert.Equal(wiBug.Id, actualLink.SourceId);
var wiTask = fixture.WorkItemStore.GetWorkItem(actualLink.TargetId);
Assert.NotNull(wiTask);
Assert.Equal("Task", wiTask.Type.Name);
Assert.Equal("Task auto-generated for " + wiBug.Title, wiTask.Title);
}
示例2: NewLink_succeeds
public void NewLink_succeeds()
{
// prepare
this.fixture.PushPolicies("NewObjects");
string workItemTypeName = "Product Backlog Item";
var targetType = this.fixture.Project.WorkItemTypes[workItemTypeName];
var wiPBI = new WorkItem(targetType);
wiPBI.Title = workItemTypeName + " NewLink_succeeds";
wiPBI.Save();
workItemTypeName = "Task";
targetType = this.fixture.Project.WorkItemTypes[workItemTypeName];
var wiTask = new WorkItem(targetType);
wiTask.Title = workItemTypeName + " NewLink_succeeds";
// trigger
wiTask.Save();
Thread.Sleep(3000);
wiPBI.SyncToLatest();
wiTask.SyncToLatest();
// validate
var hierarchyRelationship = this.fixture.WorkItemStore.WorkItemLinkTypes["System.LinkTypes.Hierarchy"];
Assert.Equal(1, wiTask.WorkItemLinks.Count);
var actualLink = wiTask.WorkItemLinks[0];
Assert.Equal(hierarchyRelationship.ReverseEnd.ImmutableName, actualLink.LinkTypeEnd.ImmutableName);
Assert.Equal(wiTask.Id, actualLink.SourceId);
Assert.Equal(1, actualLink.TargetId);
}