public IActionResult PushMessagesList(DataSourceRequest command) { var messages = _pushNotificationsService.GetPushMessages(command.Page - 1, command.PageSize); var gridModel = new DataSourceResult(); gridModel.Data = messages.Select(x => new PushMessageGridModel { Id = x.Id, Text = x.Text, Title = x.Title, SentOn = _dateTimeHelper.ConvertToUserTime(x.SentOn, DateTimeKind.Utc), NumberOfReceivers = x.NumberOfReceivers }); gridModel.Total = messages.TotalCount; return(Json(gridModel)); }
public async Task CanGetMessages() { ClearPushMessages(); var message1 = new PushMessage { Text = "CanGetMessages1" }; var message2 = new PushMessage { Text = "CanGetMessages2" }; await _pushNotificationsService.InsertPushMessage(message1); await _pushNotificationsService.InsertPushMessage(message2); var found = await _pushNotificationsService.GetPushMessages(); Assert.AreEqual(2, found.Count); Assert.AreEqual(true, found.Any(x => x.Text == "CanGetMessages1")); Assert.AreEqual(true, found.Any(x => x.Text == "CanGetMessages2")); }