remove AlertType.Unknown, update tests
This commit is contained in:
@@ -64,8 +64,7 @@ namespace UptimeSharp.Tests
|
|||||||
|
|
||||||
Assert.Equal(2, specificAlerts.Count);
|
Assert.Equal(2, specificAlerts.Count);
|
||||||
|
|
||||||
await client.DeleteAlert(alerts[0]);
|
await ResetAlerts();
|
||||||
await client.DeleteAlert(alerts[1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -84,5 +83,18 @@ namespace UptimeSharp.Tests
|
|||||||
|
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task ResetAlerts()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<Alert> alerts = await client.GetAlerts();
|
||||||
|
await client.DeleteAlert(alerts[0]);
|
||||||
|
await client.DeleteAlert(alerts[1]);
|
||||||
|
await client.DeleteAlert(alerts[2]);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,13 +59,11 @@ namespace UptimeSharp
|
|||||||
throw new UptimeSharpException("AlertType.SMS and AlertType.Twitter are not supported by the UptimeRobot API");
|
throw new UptimeSharpException("AlertType.SMS and AlertType.Twitter are not supported by the UptimeRobot API");
|
||||||
}
|
}
|
||||||
|
|
||||||
AddAlertResponse response = await Request<AddAlertResponse>("newAlertContact", cancellationToken, new Dictionary<string, string>()
|
Alert alert = (await Request<AddAlertResponse>("newAlertContact", cancellationToken, new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
{ "alertContactType", ((int)type).ToString() },
|
{ "alertContactType", ((int)type).ToString() },
|
||||||
{ "alertContactValue", value }
|
{ "alertContactValue", value }
|
||||||
});
|
})).Alert;
|
||||||
|
|
||||||
Alert alert = response.Alert;
|
|
||||||
|
|
||||||
if (alert != null)
|
if (alert != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,10 +99,6 @@ namespace UptimeSharp.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum AlertStatus
|
public enum AlertStatus
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Unknown
|
|
||||||
/// </summary>
|
|
||||||
Unknown,
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Not activated
|
/// Not activated
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
<Compile Include="Models\Parameters\MonitorParameters.cs" />
|
<Compile Include="Models\Parameters\MonitorParameters.cs" />
|
||||||
<Compile Include="Models\Parameters\Parameters.cs" />
|
<Compile Include="Models\Parameters\Parameters.cs" />
|
||||||
<Compile Include="Models\Parameters\RetrieveParameters.cs" />
|
<Compile Include="Models\Parameters\RetrieveParameters.cs" />
|
||||||
|
<Compile Include="Models\Response\AddAlertResonse.cs" />
|
||||||
<Compile Include="Models\Response\AlertResponse.cs" />
|
<Compile Include="Models\Response\AlertResponse.cs" />
|
||||||
<Compile Include="Models\Response\DefaultResponse.cs" />
|
<Compile Include="Models\Response\DefaultResponse.cs" />
|
||||||
<Compile Include="Models\Response\IResponse.cs" />
|
<Compile Include="Models\Response\IResponse.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user