Beispiel #1
0
        public void TryParse_ValidDsn_Succeeds()
        {
            var @case = new DsnTestCase();

            Assert.True(Dsn.TryParse(@case, out var dsn));

            AssertEqual(@case, dsn);
        }
Beispiel #2
0
        public void Ctor_MissingSecretKey_GetterReturnsNull()
        {
            var @case = new DsnTestCase {
                SecretKey = null
            };
            var sut = new Dsn(@case);

            Assert.Null(sut.SecretKey);
        }
Beispiel #3
0
        public void TryParse_EmptyPath_Succeeds()
        {
            var @case = new DsnTestCase {
                Path = string.Empty
            };

            Assert.True(Dsn.TryParse(@case, out var dsn));
            AssertEqual(@case, dsn);
        }
Beispiel #4
0
        public void TryParse_FutureScheme_Succeeds()
        {
            var @case = new DsnTestCase {
                Scheme = "hypothetical"
            };

            Assert.True(Dsn.TryParse(@case, out var dsn));
            AssertEqual(@case, dsn);
        }
Beispiel #5
0
        public void Ctor_FutureScheme_ValidDsn()
        {
            var @case = new DsnTestCase {
                Scheme = "hypothetical"
            };
            var dsn = new Dsn(@case);

            AssertEqual(@case, dsn);
        }
Beispiel #6
0
        public void TryParse_InvalidHost_Fails()
        {
            var @case = new DsnTestCase {
                Host = null
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
Beispiel #7
0
        public void Ctor_MissingScheme_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Scheme = null
            };
            var ex = Assert.Throws <UriFormatException>(() => new Dsn(@case));

            Assert.Equal("Invalid URI: The format of the URI could not be determined.", ex.Message);
        }
Beispiel #8
0
        public void TryParse_MissingProjectId_Fails()
        {
            var @case = new DsnTestCase {
                ProjectId = null
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
Beispiel #9
0
        public void TryParse_InvalidPort_Fails()
        {
            var @case = new DsnTestCase {
                Port = -1
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
Beispiel #10
0
        public void Ctor_MissingPublicKey_ThrowsArgumentException()
        {
            var @case = new DsnTestCase {
                PublicKey = null
            };
            var ex = Assert.Throws <ArgumentException>(() => new Dsn(@case));

            Assert.Equal("Invalid DSN: No public key provided.", ex.Message);
        }
Beispiel #11
0
        public void TryParse_MissingPublicAndSecretKey_Fails()
        {
            var @case = new DsnTestCase {
                PublicKey = null, SecretKey = null, UserInfoSeparator = null, CredentialSeparator = null
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
Beispiel #12
0
    public void TryParse_ValidDsn_Succeeds()
    {
        var @case = new DsnTestCase();
        var dsn   = Dsn.TryParse(@case);

        Assert.NotNull(dsn);

        AssertEqual(@case, dsn);
    }
Beispiel #13
0
        public void Ctor_InvalidHost_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Host = null
            };
            var ex = Assert.Throws <UriFormatException>(() => new Dsn(@case));

            Assert.Equal("Invalid URI: The hostname could not be parsed.", ex.Message);
        }
Beispiel #14
0
        public void TryParse_MissingScheme_Fails()
        {
            var @case = new DsnTestCase {
                Scheme = null
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
Beispiel #15
0
        public void Ctor_InvalidPort_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Port = -1
            };
            var ex = Assert.Throws <UriFormatException>(() => new Dsn(@case));

            Assert.Equal("Invalid URI: Invalid port specified.", ex.Message);
        }
Beispiel #16
0
        public void Ctor_MissingProjectId_ThrowsArgumentException()
        {
            var @case = new DsnTestCase {
                ProjectId = null
            };
            var ex = Assert.Throws <ArgumentException>(() => new Dsn(@case));

            Assert.Equal("Invalid DSN: A Project Id is required.", ex.Message);
        }
Beispiel #17
0
        public void Ctor_MissingPublicAndSecretKey_ThrowsArgumentException()
        {
            var @case = new DsnTestCase {
                PublicKey = null, SecretKey = null, UserInfoSeparator = null, CredentialSeparator = null
            };
            var ex = Assert.Throws <ArgumentException>(() => new Dsn(@case));

            Assert.Equal("Invalid DSN: No public key provided.", ex.Message);
        }
Beispiel #18
0
        public void Ctor_EmptyPath_ValidDsn()
        {
            var @case = new DsnTestCase {
                Path = string.Empty
            };
            var dsn = new Dsn(@case);

            AssertEqual(@case, dsn);
        }
Beispiel #19
0
        public void TryParse_MissingSecretKey_Succeeds()
        {
            var @case = new DsnTestCase {
                SecretKey = null
            };

            Assert.True(Dsn.TryParse(@case, out var dsn));
            AssertEqual(@case, dsn);
        }
Beispiel #20
0
    public void TryParse_EmptyPath_Succeeds()
    {
        var @case = new DsnTestCase {
            Path = string.Empty
        };
        var dsn = Dsn.TryParse(@case);

        Assert.NotNull(dsn);
        AssertEqual(@case, dsn);
    }
Beispiel #21
0
    public void TryParse_FutureScheme_Succeeds()
    {
        var @case = new DsnTestCase {
            Scheme = "hypothetical"
        };
        var dsn = Dsn.TryParse(@case);

        Assert.NotNull(dsn);
        AssertEqual(@case, dsn);
    }
Beispiel #22
0
    public void TryParse_MissingSecretKey_Succeeds()
    {
        var @case = new DsnTestCase {
            SecretKey = null
        };
        var dsn = Dsn.TryParse(@case);

        Assert.NotNull(dsn);
        AssertEqual(@case, dsn);
    }