public void ConvertNullAPIToAPI()
        {
            apiAuth1 = null;
            converter = new AuthenticationConverter(apiAuth1);

            Assert.IsNull(converter.ToAPIAuthentication());
        }
Ejemplo n.º 2
0
        internal Silanis.ESL.API.Auth ToAPIAuthentication()
        {
            Silanis.ESL.API.Auth auth = new Silanis.ESL.API.Auth();

            auth.Scheme = Scheme();

            foreach (Challenge challenge in challenges)
            {
                Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();

                authChallenge.Question = challenge.Question;
                authChallenge.Answer   = challenge.Answer;
                auth.AddChallenge(authChallenge);
            }

            if (!String.IsNullOrEmpty(PhoneNumber))
            {
                Silanis.ESL.API.AuthChallenge challenge = new Silanis.ESL.API.AuthChallenge();

                challenge.Question = PhoneNumber;
                auth.AddChallenge(challenge);
            }

            return(auth);
        }
Ejemplo n.º 3
0
		internal Silanis.ESL.API.Auth ToAPIAuthentication ()
		{
			Silanis.ESL.API.Auth auth = new Silanis.ESL.API.Auth ();

			auth.Scheme = Scheme ();

			foreach (Challenge challenge in challenges)
			{
				Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();

				authChallenge.Question = challenge.Question;
				authChallenge.Answer = challenge.Answer;
				auth.AddChallenge (authChallenge);
			}

			if (!String.IsNullOrEmpty (PhoneNumber))
			{
				Silanis.ESL.API.AuthChallenge challenge = new Silanis.ESL.API.AuthChallenge ();

				challenge.Question = PhoneNumber;
				auth.AddChallenge (challenge);
			}

			return auth;
		}
Ejemplo n.º 4
0
        public void ConvertNullAPIToAPI()
        {
            apiAuth1  = null;
            converter = new AuthenticationConverter(apiAuth1);

            Assert.IsNull(converter.ToAPIAuthentication());
        }
        public void ConvertAPIToAPI()
        {
            apiAuth1 = CreateTypicalAPIAuthentication();
            converter = new AuthenticationConverter(apiAuth1);
            apiAuth2 = converter.ToAPIAuthentication();

            Assert.IsNotNull(apiAuth2);
            Assert.AreEqual(apiAuth2, apiAuth1);
        }
Ejemplo n.º 6
0
        public void ConvertAPIToAPI()
        {
            apiAuth1  = CreateTypicalAPIAuthentication();
            converter = new AuthenticationConverter(apiAuth1);
            apiAuth2  = converter.ToAPIAuthentication();

            Assert.IsNotNull(apiAuth2);
            Assert.AreEqual(apiAuth2, apiAuth1);
        }
        public void ConvertAPIToSDK()
        {
            apiAuth1 = CreateTypicalAPIAuthentication();
            sdkAuth1 = new AuthenticationConverter(apiAuth1).ToSDKAuthentication();

            Assert.IsNotNull(sdkAuth1);
            Assert.AreEqual(sdkAuth1.Method.ToString(), apiAuth1.Scheme.ToString());
            Assert.AreEqual(sdkAuth1.Challenges[0].Question, apiAuth1.Challenges[0].Question);
            Assert.AreEqual(sdkAuth1.Challenges[0].Answer, apiAuth1.Challenges[0].Answer);
        }
Ejemplo n.º 8
0
        public void ConvertSDKToAPI()
        {
            sdkAuth1 = CreateTypicalSDKAuthentication();
            apiAuth1 = new AuthenticationConverter(sdkAuth1).ToAPIAuthentication();

            Assert.IsNotNull(apiAuth1);
            Assert.AreEqual(apiAuth1.Scheme.ToString(), sdkAuth1.Method.ToString());
            Assert.AreEqual(apiAuth1.Challenges[0].Question, sdkAuth1.Challenges[0].Question);
            Assert.AreEqual(apiAuth1.Challenges[0].Answer, sdkAuth1.Challenges[0].Answer);
        }
        public void ConvertAPIToSDK()
        {
            apiAuth1 = CreateTypicalAPIAuthentication();
            sdkAuth1 = new AuthenticationConverter(apiAuth1).ToSDKAuthentication();

            Assert.IsNotNull(sdkAuth1);
            Assert.AreEqual(sdkAuth1.Method.getApiValue(), apiAuth1.Scheme);
            Assert.AreEqual(sdkAuth1.Challenges[0].Question, apiAuth1.Challenges[0].Question);
            Assert.AreEqual(sdkAuth1.Challenges[0].Answer, apiAuth1.Challenges[0].Answer);
        }
Ejemplo n.º 10
0
        private Silanis.ESL.API.Auth CreateTypicalAPIAuthentication()
        {
            Silanis.ESL.API.Auth          result        = new Silanis.ESL.API.Auth();
            Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();
            authChallenge.Question  = "What is the name of your dog?";
            authChallenge.Answer    = "Max";
            authChallenge.MaskInput = true;
            result.AddChallenge(authChallenge);
            result.Scheme = Silanis.ESL.API.AuthScheme.CHALLENGE;

            return(result);
        }
        private Silanis.ESL.API.Auth CreateTypicalAPIAuthentication()
        {
            Silanis.ESL.API.Auth result = new Silanis.ESL.API.Auth();
            Silanis.ESL.API.AuthChallenge authChallenge = new Silanis.ESL.API.AuthChallenge();
            authChallenge.Question = "What is the name of your dog?";
            authChallenge.Answer = "Max";
            authChallenge.MaskInput = true;
            result.AddChallenge(authChallenge);
            result.Scheme = Silanis.ESL.API.AuthScheme.CHALLENGE;

            return result;
        }