public void FromErrorHttpStatusCode_MarkErrorDataAsExpected_ExpectedStatusCodes(bool hasExpectedError)
        {
            if (hasExpectedError)
            {
                var expectedStatusCodes = "400,401,404-415";
                SetupConfiguration(null, null, null, null, false, null, null, expectedStatusCodes, errorCollectorEnabled: true);
            }

            var errorData1 = _errorService.FromErrorHttpStatusCode(400, null, DateTime.Now);
            var errorData2 = _errorService.FromErrorHttpStatusCode(401, 4, DateTime.Now);
            var errorData3 = _errorService.FromErrorHttpStatusCode(405, null, DateTime.Now);
            var errorData4 = _errorService.FromErrorHttpStatusCode(500, null, DateTime.Now);

            if (hasExpectedError)
            {
                Assert.IsTrue(errorData1.IsExpected);
                Assert.IsTrue(errorData2.IsExpected);
                Assert.IsTrue(errorData3.IsExpected);
                Assert.IsFalse(errorData4.IsExpected);
            }
            else
            {
                Assert.IsFalse(errorData1.IsExpected);
                Assert.IsFalse(errorData2.IsExpected);
                Assert.IsFalse(errorData3.IsExpected);
                Assert.IsFalse(errorData4.IsExpected);
            }
        }
        public void SetHttpResponseStatusCode(int statusCode, int?subStatusCode, IErrorService errorService)
        {
            _httpResponseStatusCode    = statusCode;
            _httpResponseSubStatusCode = subStatusCode.HasValue ? (int)subStatusCode : int.MinValue;

            if (statusCode >= 400)
            {
                if (!errorService.ShouldIgnoreHttpStatusCode(statusCode, subStatusCode))
                {
                    var errorData = errorService.FromErrorHttpStatusCode(statusCode, subStatusCode, DateTime.UtcNow);
                    TransactionErrorState.AddStatusCodeErrorData(errorData);
                }
                else
                {
                    TransactionErrorState.SetIgnoreAgentNoticedErrors();
                }
            }
        }