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); } }
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); } }
public HttpMiddleware(RequestDelegate _, StateProjection computeLimits) { _stateProjection = computeLimits; }
public TcpMiddleware(StateProjection computeLimits) { _stateProjection = computeLimits; }