public override void Validate()
        {
            if (string.IsNullOrEmpty(Url))
            {
                throw new ArgumentNullException(string.Format(ErrorMessagePropMissing, "Url"));
            }

            if (string.IsNullOrEmpty(Username))
            {
                throw new ArgumentNullException(string.Format(ErrorMessagePropMissing, "Username"));
            }

            if (string.IsNullOrEmpty(Password))
            {
                throw new ArgumentNullException(string.Format(ErrorMessagePropMissing, "Password"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(Url))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "Url"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(Username))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "Username"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(Password))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "Password"));
            }
        }
        public override void Validate()
        {
            if (string.IsNullOrEmpty(BearerToken))
            {
                throw new ArgumentNullException(string.Format(ErrorMessagePropMissing, "BearerToken"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(BearerToken))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "BearerToken"));
            }
        }
Exemple #3
0
        public void TestHasBadStartOrEndChar()
        {
            var bracketBegin = "{value";
            var bracketEnd   = "value}";
            var quoteBegin   = "\"value";
            var quoteEnd     = "value\"";
            var goodValue    = "value";

            var testBracketBegin = CredentialUtils.HasBadStartOrEndChar(bracketBegin);
            var testBracketEnd   = CredentialUtils.HasBadStartOrEndChar(bracketEnd);
            var testQuoteBegin   = CredentialUtils.HasBadStartOrEndChar(quoteBegin);
            var testQuoteEnd     = CredentialUtils.HasBadStartOrEndChar(quoteEnd);
            var testGoodValue    = CredentialUtils.HasBadStartOrEndChar(goodValue);

            Assert.IsTrue(testBracketBegin);
            Assert.IsTrue(testBracketEnd);
            Assert.IsTrue(testQuoteBegin);
            Assert.IsTrue(testQuoteEnd);
            Assert.IsFalse(testGoodValue);
        }
        public override void Validate()
        {
            if (string.IsNullOrEmpty(Apikey))
            {
                throw new ArgumentNullException(string.Format(ErrorMessagePropMissing, "apikey"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(Apikey))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "apikey"));
            }

            if (CredentialUtils.HasBadStartOrEndChar(Url))
            {
                throw new ArgumentException(string.Format(ErrorMessagePropInvalid, "url"));
            }

            if (Utility.OnlyOne(ClientId, ClientSecret))
            {
                Console.WriteLine("Warning: Client ID and Secret must BOTH be given, or the defaults will be used.");
            }
        }
        public void HasBadFirstOrLastCharacterSuccessStartingEndingQuote()
        {
            bool success = CredentialUtils.HasBadStartOrEndChar("\"bogus-string\"");

            Assert.IsTrue(success);
        }
        public void HasBadFirstOrLastCharacterSuccessEndingBracket()
        {
            bool success = CredentialUtils.HasBadStartOrEndChar("bogus-string}");

            Assert.IsTrue(success);
        }