Ejemplo n.º 1
0
        public void testCreateUpdateDeleteNotification()
        {
            FigoNotification notification = new FigoNotification { ObserveKey = "/rest/transactions", NotifyURI = "http://figo.me/test", State = "qwe" };
            Task<FigoNotification> task_add = sut.AddNotification(notification);
            task_add.Wait();
            FigoNotification addedNotification = task_add.Result;
            Assert.IsNotNull(addedNotification);
            Assert.IsNotNull(addedNotification.NotificationId);
            Assert.AreEqual("/rest/transactions", addedNotification.ObserveKey);
            Assert.AreEqual("http://figo.me/test", addedNotification.NotifyURI);
            Assert.AreEqual("qwe", addedNotification.State);

            addedNotification.State = "asd";
            Task<FigoNotification> task_update = sut.UpdateNotification(addedNotification);
            task_update.Wait();

            Task<FigoNotification> task_get = sut.GetNotification(addedNotification.NotificationId);
            task_get.Wait();
            FigoNotification updatedNotification = task_get.Result;
            Assert.IsNotNull(updatedNotification);
            Assert.AreEqual(addedNotification.NotificationId, updatedNotification.NotificationId);
            Assert.AreEqual("/rest/transactions", updatedNotification.ObserveKey);
            Assert.AreEqual("http://figo.me/test", updatedNotification.NotifyURI);
            Assert.AreEqual("asd", updatedNotification.State);

            Task<bool> task_delete = sut.RemoveNotification(updatedNotification);
            task_delete.Wait();

            Task<FigoNotification> task_test = sut.GetNotification(addedNotification.NotificationId);
            task_test.Wait();
            Assert.IsNull(task_test.Result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Remove a stored notification from the server
        /// </summary>
        /// <param name="notification">Notification to be removed</param>
        public async Task <bool> RemoveNotification(FigoNotification notification)
        {
            await this.DoRequest("/rest/notifications/" + notification.NotificationId, "DELETE");

            return(true);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Update a stored notification
 /// </summary>
 /// <param name="notification">Notification with updated values</param>
 /// <returns>Updated notification</returns>
 public async Task <FigoNotification> UpdateNotification(FigoNotification notification)
 {
     return(await this.DoRequest <FigoNotification>("/rest/notifications/" + notification.NotificationId, "PUT", notification));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Register a new notification on the server for the user
 /// </summary>
 /// <param name="notification">Notification which should be registered</param>
 /// <returns>created notification including its figo ID</returns>
 public async Task <FigoNotification> AddNotification(FigoNotification notification)
 {
     return(await this.DoRequest <FigoNotification>("/rest/notifications", "POST", notification));
 }