Ejemplo n.º 1
0
        public void Execute_NoPort_DefaultPort()
        {
            var parser = new TokenConnectionStringParser();
            var option = parser.Execute($@"Hostname=localhost;api=Elasticsearch");

            Assert.That(option.Port, Is.EqualTo(9200));
        }
Ejemplo n.º 2
0
        public void Execute_WithPort_PortFromConnectionString()
        {
            var parser = new TokenConnectionStringParser();
            var option = parser.Execute($@"Hostname=localhost;port=9201;api=Elasticsearch");

            Assert.That(option.Port, Is.EqualTo(9201));
        }
Ejemplo n.º 3
0
        public void Execute_Hostname_FromConnectionString()
        {
            var parser = new TokenConnectionStringParser();
            var option = parser.Execute($@"Hostname=localhost;api=Elasticsearch");

            Assert.That(option.Hostname, Is.EqualTo("localhost"));
        }
Ejemplo n.º 4
0
        public void Execute_WithBasicAuth_BasicAuth()
        {
            var parser = new TokenConnectionStringParser();
            var option = parser.Execute($@"Hostname=localhost;port=9201;username=admin;password=p@ssw0rd;api=Elasticsearch");

            Assert.That(option.Username, Is.EqualTo("admin"));
            Assert.That(option.Password, Is.EqualTo("p@ssw0rd"));
        }
Ejemplo n.º 5
0
        public void Execute_WithHalfBasicAuth_Exception()
        {
            var parser = new TokenConnectionStringParser();

            Assert.Throws <ArgumentException>(() => parser.Execute($@"Hostname=localhost;port=9200;Username=admin;api=Elasticsearch"));
        }