예제 #1
0
        public void Request()
        {
            _inTouch.SetApplicationSettings(123456, "super_secret2");

            IsNull(_inTouch.Session, "_inTouch.Session != null");
            ThrowsAsync <NullReferenceException>(async() => await _inTouch.Request <bool>("test"));
            DoesNotThrowAsync(async() => await _inTouch.Request <bool>("test", isOpenMethod: true));

            _inTouch.Session = new APISession("access_token", 12345, 0);

            ThrowsAsync <InTouchException>(async() => await _inTouch.Request <bool>("test"));

            _inTouch.SetApplicationSettings(12345, "super_secret");
        }
예제 #2
0
        public void SettingSessionData()
        {
            _it1 = new InTouch(12345, "super_secret");

            Throws <ArgumentNullException>(() => _it1.SetSessionData("", 0));
            Throws <ArgumentException>(() => _it1.SetSessionData("access_token", 0));
            Throws <ArgumentException>(() => _it1.SetSessionData("access_token", 1, 0));
            Throws <ArgumentNullException>(() => _it1.SetSessionData(null));
            DoesNotThrow(() => _it1.SetSessionData("access_token", 1));
            IsNotNull(_it1.Session, "_it1.Session != null");

            _it1.SetApplicationSettings(123456, "super_secret2");

            IsNull(_it1.Session, "_it1.Session != null");

            _it1.SetSessionData("access_token", 1);
            _it1.SetApplicationSettings(123456, "super_secret2");

            IsNotNull(_it1.Session, "_it1.Session != null");
        }