示例#1
0
        public void CreateWidgetSessionTestNull()
        {
            //Arrange
            string[] allowedTypes = new[] { WidgetSession.TYPE_SMS, WidgetSession.TYPE_BACKUP_CODE };
            string   recipient    = null;
            Twizo    twizo        = new Twizo(apiKey, apiHost);

            //Act
            var session = twizo.CreateWidgetSession(allowedTypes, recipient);

            //Assert
            Assert.AreEqual(session.allowedTypes, allowedTypes);
            Assert.AreEqual(session.recipient, recipient);
        }
示例#2
0
        public void GetWidgetSessionTest()
        {
            //Arrange
            string recipient = "601151174973";

            string[] allowedTypes = new[] { WidgetSession.TYPE_SMS };
            Twizo    twizo        = new Twizo(apiKey, apiHost);

            //Act
            var session = twizo.CreateWidgetSession(allowedTypes, recipient);

            session.Create();
            string token      = session.sessionToken;
            var    newSession = twizo.GetWidgetSession(token, recipient);

            //Assert
            Assert.AreEqual(session.sessionToken, newSession.sessionToken);
            Assert.AreEqual(session.recipient, newSession.recipient);
        }