Example #1
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Get_Request()
        {
            HttpRequest httpRequest = new HttpRequest("unittest.aspx", "http://localhost/unittest.aspx", "");

            httpRequest.RequestType = "GET";

            var request = FacebookRequestController.GetFacebookDetailsFromRequest(httpRequest);

            Assert.IsNull(request);
        }
Example #2
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Post_Valid_Request()
        {
            HttpRequest httpRequest = new HttpRequest("unittest.aspx", "http://localhost/unittest.aspx", "");

            httpRequest.RequestType = "POST";
            SetReadonly(httpRequest.Form, false);
            httpRequest.Form.Add("signed_request", _requestDics["Valid"]);

            var request = FacebookRequestController.GetFacebookDetailsFromRequest(httpRequest);

            Assert.AreEqual(true, request.IsValid);
        }
Example #3
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Post_Invalid_Request()
        {
            HttpRequest httpRequest = new HttpRequest("unittest.aspx", "http://localhost/unittest.aspx", string.Empty);

            httpRequest.RequestType = "POST";
            this.SetReadonly(httpRequest.Form, false);
            httpRequest.Form.Add("signed_request", this._requestDics["Invalid"]);

            var request = FacebookRequestController.GetFacebookDetailsFromRequest(httpRequest);

            Assert.IsNull(request);
        }
Example #4
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Valid_Request_String_ForAPage()
        {
            var request = FacebookRequestController.GetFacebookDetailsFromRequest(_requestDics["ValidForAPage"]);

            Assert.AreEqual(true, request.IsValid);
            Assert.AreEqual("HMAC-SHA256", request.Algorithm);
            Assert.AreEqual(ConvertToTimestamp(1319488107), request.IssuedAt);

            //user stuff
            Assert.AreEqual("ca", request.UserCountry);
            Assert.AreEqual("en_US", request.UserLocale);
            Assert.AreEqual(21, request.UserMinAge);
            Assert.AreEqual(0, request.UserMaxAge);

            //page
            Assert.AreEqual("130634540372728", request.PageId);
            Assert.AreEqual(false, request.PageLiked);
            Assert.AreEqual(true, request.PageUserAdmin);
        }
Example #5
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Valid_Request_String()
        {
            var request = FacebookRequestController.GetFacebookDetailsFromRequest(_requestDics["Valid"]);

            Assert.AreEqual(true, request.IsValid);
        }
Example #6
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Invalid_Request_String()
        {
            var request = FacebookRequestController.GetFacebookDetailsFromRequest(_requestDics["Invalid"]);

            Assert.IsNull(request);
        }
Example #7
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Empty_Request()
        {
            var request = FacebookRequestController.GetFacebookDetailsFromRequest(null as HttpRequest);

            Assert.IsNull(request);
        }
Example #8
0
        public void FacebookRequestController_GetFacebookDetailsFromRequest_With_Empty_Request_String()
        {
            var request = FacebookRequestController.GetFacebookDetailsFromRequest(this._requestDics["Empty"]);

            Assert.IsNull(request);
        }