public async Task SetNotificationStatusAsync_StatusSetSuccessfully() { // Arrange var notificationId = 527012; var notification = NotificationClient .List() .Filter(e => e.Id.IsEqual(notificationId)) .Get().Data.Items.First(); var notificationStatus = (NotificationUserStatus) new List <int> { 0, 1 } .First(e => e != (int)notification.Status); var model = new List <NotificationPutModel>() { new NotificationPutModel { Id = notificationId, Status = notificationStatus }, }; // Act var result = (await NotificationClient.ChangeStatusAsync(model)).AssertResult(); // Assert Assert.IsNotNull(result.First()); Assert.AreEqual(notificationStatus, result.First().Status); }
public async Task ListProducesCorrectResponse() { NotificationClient client = null; client = GetClient(req => new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(Utility.GetExampleJson("NotificationList.json")) }); var response = await client.List(NotificationState.Any); Assert.Single(response.Notifications); }
public async Task GetListAsync_BankStatementNotification_Success() { // Act var result = (await NotificationClient.List() .Filter(n => n.Type.IsEqual(NotificationType.BankStatement)) .GetAsync()) .AssertResult(); // Assert AssertNonEmptyListResult(result); AssertBankStatementNotification(result.Items.First()); }
public async Task ListArchivedGeneratesCorrectRequest() { NotificationClient client = null; client = GetClient(req => { Assert.Equal(HttpMethod.Get, req.Method); Assert.Equal(req.RequestUri.ToString(), client.NotificationUri(string.Empty, "archived").ToString()); Assert.Equal("xxx", req.Headers.Authorization.Parameter); return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(Utility.GetExampleJson("NotificationList.json")) }); }); await client.List(NotificationState.Archived); }