public ConnectionInitializer(
     string applicationName,
     IReadOnlyList <CompressorConfiguration> compressors,
     ServerApi serverApi)
 {
     _clientDocument = ClientDocumentHelper.CreateClientDocument(applicationName);
     _compressors    = Ensure.IsNotNull(compressors, nameof(compressors));
     _serverApi      = serverApi;
 }
Esempio n. 2
0
        public void CreateClientDocument_should_return_expected_result()
        {
            var result = ClientDocumentHelper.CreateClientDocument(null);

            var names = result.Names.ToList();

            names.Count.Should().Be(3);
            names[0].Should().Be("driver");
            names[1].Should().Be("os");
            names[2].Should().Be("platform");
        }
Esempio n. 3
0
        public void CreateClientDocument_with_args_should_return_expected_result(
            [Values(null, "app1", "app2")]
            string applicationName,
            [Values("{ name : 'mongo-csharp-driver', version : '2.4.0' }", "{ name : 'mongo-csharp-driver', version : '2.4.1' }")]
            string driverDocumentString,
            [Values(
                 "{ type : 'Windows', name : 'Windows 10', architecture : 'x86_64', version : '10.0' }",
                 "{ type : 'Windows', name : 'Windows 10', architecture : 'x86_64', version : '10.1' }")]
            string osDocumentString,
            [Values("net45", "net46")]
            string platformString)
        {
            var driverDocument = BsonDocument.Parse(driverDocumentString);
            var osDocument     = BsonDocument.Parse(osDocumentString);

            var result = ClientDocumentHelper.CreateClientDocument(applicationName, driverDocument, osDocument, platformString);

            var applicationNameElement = applicationName == null ? null : $"application : {{ name : '{applicationName}' }},";
            var expectedResult         = $"{{ {applicationNameElement} driver : {driverDocumentString}, os : {osDocumentString}, platform : '{platformString}' }}";

            result.Should().Be(expectedResult);
        }
Esempio n. 4
0
 public ConnectionInitializer(string applicationName)
 {
     _clientDocument = ClientDocumentHelper.CreateClientDocument(applicationName);
 }