Ejemplo n.º 1
0
        public async Task TestNotification()
        {
            var alert = new NotificationRequestAlert().SetDefaults();

            alert.Type    = 0;
            alert.Message = "Hi";
            Assert.NotNull(alert.ToString());
            Assert.NotNull(alert.ToJson());

            Assert.True(Guid.TryParse(TestUserId, out Guid guid));
            var notificationRequest = new NotificationRequest();//.SetDefaults();

            try {
                notificationRequest.SetDefaults();
            }catch (Exception e) {}//Right now this throws an invalid Guid exception -- TODO this is not the intended behavior.
            notificationRequest.To    = guid;
            notificationRequest.Alert = alert;
            Assert.NotNull(notificationRequest.ToString());
            Assert.NotNull(notificationRequest.ToJson());

            var notificationResponse = await SkyManager.ApiClient.ExecuteRequestAsync(new Skylight.Api.Messaging.V1.NotificationsRequests.NotificationsPostRequest(notificationRequest));

            var result = notificationResponse.Content;

            Assert.NotNull(result.ToString());
            Assert.NotNull(result.ToJson());
            Assert.NotNull(result.Result);
            result.SetDefaults();
        }
Ejemplo n.º 2
0
 public NotificationContent(NotificationRequest <T> req) :
     base(req.ToJson(), Encoding.UTF8, "application/json")
 {
 }