public async Task PushWithDefaultKey_ReturnsSuccessful() { // Arrange string title = "Test title"; string text = "This is a test push notification message"; // Act Pushover pclient = new Pushover(TEST_APP_KEY, TEST_USER_KEY); var message = new PushoverMessage() { Title = title, Text = text }; PushoverResponse response = await pclient.SendPushAsync(message); // Assert Assert.IsNotNull(response); Assert.AreEqual(1, response.Status); }
public async Task PushWithNoKey_ReturnsError() { // Arrange string title = "Test title"; string text = "This is a test push notification message"; // Act Pushover pclient = new Pushover(TEST_APP_KEY); var message = new PushoverMessage() { Title = title, Text = text }; PushoverResponse response = await pclient.SendPushAsync(message); // Assert - above code should error before this Assert.Fail(); }
public void PushWithValidParms_ReturnsSuccessful() { // Arrange string title = "Test title"; string text = "This is a test push notification message"; // Act Pushover pclient = new Pushover(TEST_APP_KEY); var message = new PushoverMessage() { Title = title, Text = text }; message.Recipients.Add(TEST_USER_KEY); PushoverResponse response = pclient.SendPush(message); // Assert Assert.IsNotNull(response); Assert.AreEqual(1, response.Status); }
static void Main(string[] args) { log4net.Config.XmlConfigurator.Configure(); System.ServiceModel.ServiceHost _hostApplication = new System.ServiceModel.ServiceHost(typeof(SoftFluent.Presence.Service.PresenceRestService)); _hostApplication.Open(); PushoverClient client = new PushoverClient(); client.SendNotification("first message"); PushoverRequest request = PushoverRequest.CreateRequest("Test", "Presence", PushoverPriorityNotificationType.LowPriority, "Tel_Softfluent"); //PushoverRequest request = PushoverRequest.CreateRequest("Test", null, 30, 120, PushoverPriorityNotificationType.EmergencyPriority, "Tel_Softfluent"); //request.TimeStamp = new DateTime(2016, 1, 31, 10, 5, 0); PushoverResponse response = client.SendNotification(request); if (response != null && response.Status == 1) { //OK client.CancelEmergency(""); } }
/// <summary> /// Initializes a new instance of the <see cref="RateLimitExceededException"/> class with a reference to the /// <see cref="PushoverResponse"/> and a reference to the inner exception that are the cause of this exception. /// </summary> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> /// <param name="innerException"> /// The exception that is the cause of the current exception, or a null reference if no inner exception. /// </param> public RateLimitExceededException(PushoverResponse response, Exception innerException) : base("Rate limit exceeded", response, innerException) { this.RateLimitInfo = response.RateLimitInfo; }
/// <summary> /// Initializes a new instance of the <see cref="RateLimitExceededException"/> class with a reference to the /// <see cref="PushoverResponse"/> a that is the cause of this exception. /// </summary> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> public RateLimitExceededException(PushoverResponse response) : this(response, null) { }
/// <summary> /// Initializes a new instance of the <see cref="ResponseException"/> class with a specified error message, /// a reference to the <see cref="PushoverResponse"/> and a reference to the inner exception that are the cause /// of this exception. /// </summary> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> /// <param name="innerException"> /// The exception that is the cause of the current exception, or a null reference if no inner exception. /// </param> public ResponseException(string message, PushoverResponse response, Exception innerException) : base(message, innerException) { this.Response = response; }
/// <summary> /// Initializes a new instance of the <see cref="ResponseException"/> class with a specified error message and /// a reference to the <see cref="PushoverResponse"/> that is the cause of this exception. /// </summary> /// <param name="message">The error message that explains the reason for the exception.</param> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> public ResponseException(string message, PushoverResponse response) : this(message, response, null) { }
/// <summary> /// Initializes a new instance of the <see cref="BadRequestException"/> class with a reference to the /// <see cref="PushoverResponse"/> and a reference to the inner exception that are the cause of this exception. /// </summary> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> /// <param name="innerException"> /// The exception that is the cause of the current exception, or a null reference if no inner exception. /// </param> public BadRequestException(PushoverResponse response, Exception innerException) : base("Bad request", response, innerException) { }
/// <summary> /// Initializes a new instance of the <see cref="BadRequestException"/> class with a reference to the /// <see cref="PushoverResponse"/> a that is the cause of this exception. /// </summary> /// <param name="response">The <see cref="PushoverResponse"/> that is the cause for the exception.</param> public BadRequestException(PushoverResponse response) : this(response, null) { }