public async Task DynamicSensorParameters_SensorQueryParameters_ParsesParametersAsync() { var client = Initialize_Client(new SensorQueryTargetParametersValidatorResponse(new[] { UnitRequest.SensorTypes(1001), UnitRequest.BeginAddSensorQuery(1001, "ptfadsreplfailurexml"), UnitRequest.ContinueAddSensorQuery(2055, 7, "database_=XE&sid_type_=0&prefix_=0"), UnitRequest.AddSensorProgress(1001, 7), UnitRequest.EndAddSensorQuery(1001, 7) })); await client.GetDynamicSensorParametersAsync(1001, "ptfadsreplfailurexml", queryParameters : new SensorQueryTargetParameters { ["database"] = "XE", ["sid_type"] = 0, ["prefix"] = 0 }); }
public void AddSensor_SensorQueryParameters_SynthesizesParameters() { var client = Initialize_Client(new SensorQueryTargetParametersValidatorResponse(new[] { UnitRequest.Status(), UnitRequest.BeginAddSensorQuery(1001, "oracletablespace"), UnitRequest.ContinueAddSensorQuery(2055, 7, "database_=XE&sid_type_=0&prefix_=0"), //Response hardcodes 2055, however normally this will in fact match UnitRequest.AddSensor("name_=test&priority_=3&inherittriggers_=1&intervalgroup=1&interval_=60%7C60+seconds&errorintervalsdown_=1&database=XE&sid_type=0&prefix=0&sensortype=oracletablespace&id=1001") })); var parameters = new RawSensorParameters("test", "oracletablespace") { ["database"] = "XE", ["sid_type"] = 0, ["prefix"] = 0 }; client.AddSensor(1001, parameters, false); }
public void DynamicSensorParameters_SensorQueryParameters_ParsesParameters_ContainingNewLines() { //The issue is that even though we encode our newlines, the response URI has then un-encoded. This causes our attempts to extract a tmpid to fail without specifying RegexOptions.Singleline var client = Initialize_Client(new SensorQueryTargetParametersValidatorResponse(new[] { UnitRequest.SensorTypes(1001), UnitRequest.BeginAddSensorQuery(1001, "ptfadsreplfailurexml"), UnitRequest.ContinueAddSensorQuery(2055, 7, "database_=First%0ASecond&sid_type_=0&prefix_=0"), UnitRequest.AddSensorProgress(1001, 7), UnitRequest.EndAddSensorQuery(1001, 7) }) { DecodeNewlines = true }); client.GetDynamicSensorParameters(1001, "ptfadsreplfailurexml", queryParameters: new SensorQueryTargetParameters { ["database"] = $"First\nSecond", ["sid_type"] = 0, ["prefix"] = 0 }); }