public void ClientExecutor_CanCreateRelativePathAndQuery() { TfsClientExecutor executor = new TfsClientExecutor(new TfsClientConfiguration() { Url = new Uri("http://dummy.contoso.com/DefaultCollection"), }); HttpRequestMessage requestMessage = executor.CreateRequestMessage(new TfsRestRequest("/relative/to/root")); Assert.Equal("/DefaultCollection/relative/to/root", requestMessage.RequestUri.AbsolutePath); }
protected TfsClient NewMockClient() { TfsClientExecutor tfsExecutor = new TfsClientExecutor(new TfsClientConfiguration { Url = new Uri("https://mock.contoso.com/"), }); tfsExecutor.MessageHandler = messageHandler; return(new TfsClient(tfsExecutor)); }
public void ClientExecutor_CanSetUserAgent(string given) { TfsClientExecutor executor = new TfsClientExecutor(new TfsClientConfiguration() { Url = new Uri("http://dummy.contoso.com/"), UserAgent = given, }); HttpRequestMessage requestMessage = executor.CreateRequestMessage(new TfsRestRequest("/dummy")); Assert.Equal(given, requestMessage.Headers.UserAgent.ToString()); }
public void ClientExecutor_SetsDefaultUserAgent() { TfsClientExecutor executor = new TfsClientExecutor(new TfsClientConfiguration() { Url = new Uri("http://dummy.contoso.com/") }); HttpRequestMessage requestMessage = executor.CreateRequestMessage(new TfsRestRequest("/dummy")); string[] components = requestMessage.Headers.UserAgent.ToString().Split(new char[] { '/' }, 2); string[] version = components[1].Split(new char[] { '.' }); Assert.Equal("Infinity.Net", components[0]); Assert.Equal(3, version.Length); int.Parse(version[0]); int.Parse(version[1]); int.Parse(version[2]); }