コード例 #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);
        }