コード例 #1
0
        public void Ctor_MissingSecretKey_GetterReturnsNull()
        {
            var @case = new DsnTestCase {
                SecretKey = null
            };
            var sut = Dsn.Parse(@case);

            Assert.Null(sut.SecretKey);
        }
コード例 #2
0
        public void Ctor_FutureScheme_ValidDsn()
        {
            var @case = new DsnTestCase {
                Scheme = "hypothetical"
            };
            var dsn = Dsn.Parse(@case);

            AssertEqual(@case, dsn);
        }
コード例 #3
0
        public void Ctor_EmptyPath_ValidDsn()
        {
            var @case = new DsnTestCase {
                Path = string.Empty
            };
            var dsn = Dsn.Parse(@case);

            AssertEqual(@case, dsn);
        }
コード例 #4
0
        public void TryParse_ValidDsn_Succeeds()
        {
            var @case = new DsnTestCase();
            var dsn   = Dsn.TryParse(@case);

            Assert.NotNull(dsn);

            AssertEqual(@case, dsn);
        }
コード例 #5
0
        public void Ctor_MissingScheme_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Scheme = null
            };
            var ex = Assert.Throws <UriFormatException>(() => Dsn.Parse(@case));

            Assert.Equal("Invalid URI: The format of the URI could not be determined.", ex.Message);
        }
コード例 #6
0
        public void Ctor_InvalidHost_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Host = null
            };
            var ex = Assert.Throws <UriFormatException>(() => Dsn.Parse(@case));

            Assert.Equal("Invalid URI: The hostname could not be parsed.", ex.Message);
        }
コード例 #7
0
        public void Ctor_InvalidPort_ThrowsUriFormatException()
        {
            var @case = new DsnTestCase {
                Port = -1
            };
            var ex = Assert.Throws <UriFormatException>(() => Dsn.Parse(@case));

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

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

            Assert.Equal("Invalid DSN: No public key provided.", ex.Message);
        }
コード例 #10
0
        public void TryParse_MissingSecretKey_Succeeds()
        {
            var @case = new DsnTestCase {
                SecretKey = null
            };
            var dsn = Dsn.TryParse(@case);

            Assert.NotNull(dsn);
            AssertEqual(@case, dsn);
        }
コード例 #11
0
        public void TryParse_EmptyPath_Succeeds()
        {
            var @case = new DsnTestCase {
                Path = string.Empty
            };
            var dsn = Dsn.TryParse(@case);

            Assert.NotNull(dsn);
            AssertEqual(@case, dsn);
        }
コード例 #12
0
        public void TryParse_FutureScheme_Succeeds()
        {
            var @case = new DsnTestCase {
                Scheme = "hypothetical"
            };
            var dsn = Dsn.TryParse(@case);

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