public async Task ProcessEmailRequestBatch_CannotBeRetried()
        {
            var graphRequests = this.GetGraphRequest();

            var httpresponsemessage = this.GetEmailResponseMessage(graphRequests, "ErrorSubmissionQuotaExceeded", "Quota Exceeded", HttpStatusCode.TooManyRequests);

            var handlerMock = new Mock <HttpMessageHandler>();

            _ = handlerMock
                .Protected()
                .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
                .ReturnsAsync(httpresponsemessage);

            var       httpClient      = new HttpClient(handlerMock.Object);
            Exception ex              = null;
            var       msGrpahProvider = new MSGraphProvider(this.MsGraphSetting, Options.Create(this.retrySetting), this.Logger, httpClient);

            try
            {
                var result = await msGrpahProvider.ProcessEmailRequestBatch(this.TestTokenHeader, graphRequests).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                ex = e;
            }

            Assert.IsTrue(ex?.Message?.Contains("An error occurred while processing notification batch", StringComparison.OrdinalIgnoreCase));
        }
        public async Task ProcessEmailRequestBatch_Response_Null()
        {
            var graphRequests = this.GetGraphRequest();

            Exception ex = null;
            var       msGrpahProvider = new MSGraphProvider(this.MsGraphSetting, Options.Create(this.retrySetting), this.Logger, this.MockedHttpClient.Object);

            try
            {
                var result = await msGrpahProvider.ProcessEmailRequestBatch(this.TestTokenHeader, graphRequests).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                ex = e;
            }

            Assert.IsTrue(ex?.Message?.Contains("An error occurred while processing notification batch", StringComparison.OrdinalIgnoreCase));
        }
        public async Task ProcessEmailRequestBatch_Success()
        {
            var graphRequests = this.GetGraphRequest();

            var httpresponsemessage = this.GetEmailResponseMessage(graphRequests, null, null, HttpStatusCode.Accepted);

            var handlerMock = new Mock <HttpMessageHandler>();

            _ = handlerMock
                .Protected()
                .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
                .ReturnsAsync(httpresponsemessage);

            var httpClient = new HttpClient(handlerMock.Object);

            var msGrpahProvider = new MSGraphProvider(this.MsGraphSetting, Options.Create(this.retrySetting), this.Logger, httpClient);
            var result          = await msGrpahProvider.ProcessEmailRequestBatch(this.TestTokenHeader, graphRequests).ConfigureAwait(false);

            Assert.AreEqual(2, result.Where(x => x.Status == HttpStatusCode.Accepted).Count());
        }