Skip to content

Instantly share code, notes, and snippets.

@BryanWilhite
Last active August 29, 2015 14:09
Show Gist options
  • Save BryanWilhite/83def23d59b8b8f04288 to your computer and use it in GitHub Desktop.
Save BryanWilhite/83def23d59b8b8f04288 to your computer and use it in GitHub Desktop.
C#: TfsTeamProjectCollection
[TestClass]
public class SampleTest
{
[TestMethod]
public void ShouldListChangesetsByProject()
{
using (var server = new TfsTeamProjectCollection(new Uri("http://mytfs:8080/tfs/", UriKind.Absolute)))
{
var versionControl = server.GetService(typeof(VersionControlServer)) as VersionControlServer;
var set = versionControl.GetItems(@"$/MyTfsProject/MyPath", RecursionType.Full);
var report = string.Empty;
set.Items
.Where(i => !i.IsContentDestroyed)
.Where(i => i.ItemType == ItemType.File)
.Where(i => i.ChangesetId > 3862)
.ForEachInEnumerable(i =>
{
report +=
"<include name=\"" +
i.ServerItem
.Replace("$/MyTfsProject/MyPath/", string.Empty)
.Replace("/", "\\") +
"\" />" +
Environment.NewLine;
});
Assert.IsTrue(report.Length > 0);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment