public void ToStringContainsAll()
        {
            var envInfo       = new EnvironmentInformation();
            var serialization = envInfo.ToString();

            Assert.IsTrue(serialization.Contains(envInfo.ClientVersion));
            Assert.IsTrue(serialization.Contains(envInfo.ProcessArchitecture));
            Assert.IsTrue(serialization.Contains(envInfo.RuntimeFramework));
            Assert.IsTrue(serialization.Contains(envInfo.ClientId));
        }
Esempio n. 2
0
        public void UserAgentContainsEnvironmentInformation()
        {
            EnvironmentInformation environmentInformation = new EnvironmentInformation();
            string expectedValue = environmentInformation.ToString();
            CosmosClientOptions cosmosClientOptions = new CosmosClientOptions();
            string userAgentSuffix = "testSuffix";

            cosmosClientOptions.ApplicationName = userAgentSuffix;

            Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.EndsWith(userAgentSuffix));
            Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.Contains(expectedValue));

            ConnectionPolicy connectionPolicy = cosmosClientOptions.GetConnectionPolicy();

            Assert.IsTrue(connectionPolicy.UserAgentSuffix.EndsWith(userAgentSuffix));
            Assert.IsTrue(connectionPolicy.UserAgentSuffix.Contains(expectedValue));
        }
        static UserAgentContainer()
        {
            EnvironmentInformation environmentInformation = new EnvironmentInformation();

            UserAgentContainer.cosmosBaseUserAgent = environmentInformation.ToString();
        }