コード例 #1
0
        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);
        }
コード例 #2
0
        protected TfsClient NewMockClient()
        {
            TfsClientExecutor tfsExecutor = new TfsClientExecutor(new TfsClientConfiguration
            {
                Url = new Uri("https://mock.contoso.com/"),
            });

            tfsExecutor.MessageHandler = messageHandler;
            return(new TfsClient(tfsExecutor));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        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());
        }
コード例 #6
0
        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]);
        }
コード例 #7
0
        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]);
        }