Esempio n. 1
0
 public void TestSingleWeightResponseInRange(int inputValue, int maxValue, int expected)
 {
     foreach (var systemResponse in Enum.GetValues(typeof(SystemResponse)).OfType <SystemResponse>())
     {
         var computed = StateProjection.WeightResponse(inputValue, maxValue, systemResponse);
         Assert.Equal(expected, computed);
     }
 }
Esempio n. 2
0
        public void BoundedWeight(int inputValue, int maxValue, int expected)
        {
            var state = new State
            {
                CpuPercent  = inputValue,
                IisRequests = inputValue,
            };
            var config = new AgentCheckConfig
            {
                CpuLimit         = maxValue,
                IisRequestsLimit = maxValue
            };

            foreach (var systemResponse in Enum.GetValues(typeof(SystemResponse)).OfType <SystemResponse>())
            {
                config.SystemResponse = systemResponse;
                var computed = StateProjection.ComputeWeight(state, config);
                Assert.Equal(expected, computed);
            }
        }
Esempio n. 3
0
 public HttpMiddleware(RequestDelegate _, StateProjection computeLimits)
 {
     _stateProjection = computeLimits;
 }
 public TcpMiddleware(StateProjection computeLimits)
 {
     _stateProjection = computeLimits;
 }