Пример #1
0
        public void Execute_WithPort_PortFromConnectionString()
        {
            var parser = new UriConnectionStringParser();
            var option = parser.Execute($@"elasticsearch://localhost:9201");

            Assert.That(option.Port, Is.EqualTo(9201));
        }
Пример #2
0
        public void Execute_NoPort_DefaultPort()
        {
            var parser = new UriConnectionStringParser();
            var option = parser.Execute($@"elasticsearch://localhost");

            Assert.That(option.Port, Is.EqualTo(9200));
        }
Пример #3
0
        public void Execute_Hostname_FromConnectionString()
        {
            var parser = new UriConnectionStringParser();
            var option = parser.Execute($@"elasticsearch://*****:*****@localhost:9200");

            Assert.That(option.Hostname, Is.EqualTo("localhost"));
        }
Пример #4
0
        public void CanHandle_OleDbConnectionString_False()
        {
            var parser = new UriConnectionStringParser();
            var value  = parser.CanHandle("data source=SERVER;initial catalog=DB;IntegratedSecurity=true;Provider=OLEDB.1");

            Assert.That(value, Is.False);
        }
Пример #5
0
        public void CanHandle_ElasticsearchWithApi_False()
        {
            var parser = new UriConnectionStringParser();
            var value  = parser.CanHandle($@"Hostname=localhost;port=9200;Username=admin;password=p@ssw0rd;api=Elasticsearch");

            Assert.That(value, Is.False);
        }
Пример #6
0
        public void CanHandle_UriFull_True()
        {
            var parser = new UriConnectionStringParser();
            var value  = parser.CanHandle($@"elasticsearch://*****:*****@host:9200");

            Assert.That(value, Is.True);
        }
Пример #7
0
        public void Execute_WithBasicAuth_BasicAuth()
        {
            var parser = new UriConnectionStringParser();
            var option = parser.Execute($@"elasticsearch://*****:*****@localhost:9200");

            Assert.That(option.Username, Is.EqualTo("admin"));
            Assert.That(option.Password, Is.EqualTo("passw0rd"));
        }