public void Get_ReturnsOk_WithValidParameters(string challenge, string verifyToken)
 {
     var userRealTimeController = new UserRealtimeCallbackController(null, verifyToken);
     userRealTimeController.Request = new HttpRequestMessage();
     var subscriptionVerification = new SubscriptionVerification
     {
         Challenge = challenge,
         Mode = "subscribe",
         Verify_Token = verifyToken
     };
     Assert.Equal(challenge, userRealTimeController.Get(subscriptionVerification).Content.ReadAsStringAsync().Result);
 }
 public void Get_ReturnsExpectedStatusCode(string challenge, string verifyToken, HttpStatusCode expectedStatusCode)
 {
     var userRealTimeController = new UserRealtimeCallbackController(null, verifyToken);
     userRealTimeController.Request = new HttpRequestMessage();
     var subscriptionVerification = new SubscriptionVerification
     {
         Challenge = challenge,
         Mode = "subscribe",
         Verify_Token = "bar"
     };
     Assert.Equal(expectedStatusCode, userRealTimeController.Get(subscriptionVerification).StatusCode);
 }
        public virtual HttpResponseMessage Get(SubscriptionVerification subscriptionVerification)
        {
            try
            {
                FacebookClient client = FacebookConfiguration.ClientProvider.CreateClient();
                client.VerifyGetSubscription(subscriptionVerification.Mode, subscriptionVerification.Verify_Token, subscriptionVerification.Challenge, VerifyToken);
            }
            catch (ArgumentException argumentException)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, argumentException);
            }

            return new HttpResponseMessage
            {
                Content = new StringContent(subscriptionVerification.Challenge)
            };
        }