Esempio n. 1
0
        public void ShouldThrowOnNullInput()
        {
            Action action = () => ConnectionDetails.Parse(null);

            action
            .Should()
            .ThrowExactly <ArgumentNullException>();
        }
Esempio n. 2
0
        public void ShouldThrowOnWhitespaceInput()
        {
            Action action = () => ConnectionDetails.Parse("  \t \r \n");

            action
            .Should()
            .ThrowExactly <ArgumentException>();
        }
Esempio n. 3
0
        public void ShouldThrowOnEmptyInput()
        {
            Action action = () => ConnectionDetails.Parse(string.Empty);

            action
            .Should()
            .ThrowExactly <ArgumentException>();
        }
Esempio n. 4
0
        public void ShouldParsePostgresUrlStringWithoutPort()
        {
            var details = ConnectionDetails.Parse("postgres://*****:*****@localhost/somedatabase");

            details
            .Should()
            .NotBeNull();
            details.Database
            .Should()
            .Be("somedatabase");
            details.User
            .Should()
            .Be("someuser");
            details.Password
            .Should()
            .Be("somepassword");
            details.Host
            .Should()
            .Be("localhost");
            details.Port
            .Should()
            .Be(5432);
        }
Esempio n. 5
0
        public void ShouldParsePostgresUrlStringWithoutAuthInfo()
        {
            var details = ConnectionDetails.Parse("postgres://@somehost:381/somedatabase");

            details
            .Should()
            .NotBeNull();
            details.Database
            .Should()
            .Be("somedatabase");
            details.User
            .Should()
            .BeEmpty();
            details.Password
            .Should()
            .BeEmpty();
            details.Host
            .Should()
            .Be("somehost");
            details.Port
            .Should()
            .Be(381);
        }
Esempio n. 6
0
        public void ShouldParsePostgresUrlString()
        {
            var details = ConnectionDetails.Parse("postgres://*****:*****@somehost:381/somedatabase");

            details
            .Should()
            .NotBeNull();
            details.Database
            .Should()
            .Be("somedatabase");
            details.User
            .Should()
            .Be("someuser");
            details.Password
            .Should()
            .Be("somepassword");
            details.Host
            .Should()
            .Be("somehost");
            details.Port
            .Should()
            .Be(381);
        }