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

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

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

            Assert.Null(sut.SecretKey);
        }
示例#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);
        }
示例#4
0
        public void TryParse_FutureScheme_Succeeds()
        {
            var @case = new DsnTestCase {
                Scheme = "hypothetical"
            };

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

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

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
示例#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);
        }
示例#8
0
        public void TryParse_MissingProjectId_Fails()
        {
            var @case = new DsnTestCase {
                ProjectId = null
            };

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

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
示例#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);
        }
示例#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);
        }
示例#12
0
    public void TryParse_ValidDsn_Succeeds()
    {
        var @case = new DsnTestCase();
        var dsn   = Dsn.TryParse(@case);

        Assert.NotNull(dsn);

        AssertEqual(@case, dsn);
    }
示例#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);
        }
示例#14
0
        public void TryParse_MissingScheme_Fails()
        {
            var @case = new DsnTestCase {
                Scheme = null
            };

            Assert.False(Dsn.TryParse(@case, out var dsn));
            Assert.Null(dsn);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#18
0
        public void Ctor_EmptyPath_ValidDsn()
        {
            var @case = new DsnTestCase {
                Path = string.Empty
            };
            var dsn = new Dsn(@case);

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

            Assert.True(Dsn.TryParse(@case, out var dsn));
            AssertEqual(@case, dsn);
        }
示例#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);
    }
示例#21
0
    public void TryParse_FutureScheme_Succeeds()
    {
        var @case = new DsnTestCase {
            Scheme = "hypothetical"
        };
        var dsn = Dsn.TryParse(@case);

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

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