/// <summary>
 /// Run simple test case with Exchange service and mailbox id '*****@*****.**'.
 /// </summary>
 /// <param name="testCase">Test case to run.</param>
 protected void RunSimpleExchangeServiceTestCase(Action <ExchangeService> testCase)
 {
     MockTestRunner.RunTestCase(
         testCase,
         "*****@*****.**",
         new HttpResponseMessage(HttpStatusCode.OK)
     {
         Content = new StringContent("{}")
     },
         null);
 }
 /// <summary>
 /// Run simple HTTP200 test case with empty entityResponse.
 /// </summary>
 /// <param name="testCase"></param>
 /// <param name="inlineAssertation"></param>
 protected void RunHttp200WithEmptyResponseBetaEndpoint(Action <ExchangeService> testCase, Action <HttpRequestMessage> inlineAssertation)
 {
     MockTestRunner.RunHttp200TestCase(
         testCase,
         "*****@*****.**",
         new HttpResponseMessage(HttpStatusCode.OK)
     {
         Content = new StringContent("{}")
     },
         inlineAssertation);
 }
 /// <summary>
 /// Run simple HTTP200 test case with custom content.
 /// </summary>
 /// <param name="testcase"></param>
 /// <param name="customResponse"></param>
 /// <param name="inlineAssertation"></param>
 protected void RunHttp200WithCustomResponseProdEndpoint(Action <ExchangeService> testcase, Func <string> customResponse, Action <HttpRequestMessage> inlineAssertation)
 {
     MockTestRunner.RunHttp200TestCase(
         testcase,
         "*****@*****.**",
         new HttpResponseMessage(HttpStatusCode.OK)
     {
         Content = new StringContent(customResponse())
     },
         inlineAssertation,
         Environment.Prod);
 }
 /// <summary>
 /// Run test case and return HTTP 200 (OK).
 /// </summary>
 /// <param name="testCase">Test case.</param>
 /// <param name="exchangeService">Exchange service.</param>
 /// <param name="httpReturnContent">Return content.</param>
 /// <param name="inlineAssertation">Inline assertation.</param>
 internal static void RunHttp200TestCase(
     Action <ExchangeService> testCase,
     string mailboxId,
     HttpResponseMessage httpResponseMessage,
     Action <HttpRequestMessage> inlineAssertation,
     Environment restEnvironment = Environment.Beta)
 {
     MockTestRunner.RunTestCase(
         testCase,
         mailboxId,
         httpResponseMessage,
         inlineAssertation,
         restEnvironment);
 }
        /// <summary>
        /// Run test case with custom http 400 status.
        /// </summary>
        protected void RunTestCaseWith400Status(Action <ExchangeService> testCase, Func <string> errorData, HttpStatusCode errorStatusCode)
        {
            if (errorStatusCode < (HttpStatusCode)400 && errorStatusCode > (HttpStatusCode)499)
            {
                throw new ArgumentException("Test case needs to be run with status code between 400-499");
            }

            MockTestRunner.RunTestCase(
                testCase,
                "*****@*****.**",
                new HttpResponseMessage(errorStatusCode)
            {
                Content = new StringContent(errorData())
            },
                null);
        }
        /// <summary>
        /// Run mock test case.
        /// </summary>
        /// <param name="testCase">Test case to run.</param>
        /// <param name="mailboxId">Mailbox Id.</param>
        /// <param name="mockHttpResponseMessage">Mock response message.</param>
        /// <param name="inlineAssertation">Inline assertation.</param>
        /// <param name="restEnvironment">Rest environment - Default BETA.</param>
        internal static void RunTestCase(
            Action <ExchangeService> testCase,
            string mailboxId,
            HttpResponseMessage mockHttpResponseMessage,
            Action <HttpRequestMessage> inlineAssertation,
            Environment restEnvironment = Environment.Beta)
        {
            ExchangeService exchangeService = restEnvironment == Environment.Beta
                ? MockTestRunner.GetExchangeServiceBeta(mailboxId)
                : MockTestRunner.GetExchangeServiceProd(mailboxId);

            SimpleUnitTestHttpExtension simpleUnitTestHttpExtension = new SimpleUnitTestHttpExtension(mockHttpResponseMessage);

            simpleUnitTestHttpExtension.InlineAssertation = inlineAssertation;
            exchangeService.HttpExtension = simpleUnitTestHttpExtension;

            testCase(exchangeService);
        }