UNUserNotificationCenterProtocol
全部标签 在我的应用程序中,我希望断言已以正确的格式添加了通知。我通常会使用依赖项注入(inject)来执行此操作,但我想不出一种方法来测试新的UNUserNotificationCenterAPI。我开始创建一个模拟对象来捕获通知请求:importFoundationimportUserNotificationsclassNotificationCenterMock:UNUserNotificationCenter{varrequest:UNNotificationRequest?=niloverridefuncadd(_request:UNNotificationRequest,withCo
在我的应用程序中,我希望断言已以正确的格式添加了通知。我通常会使用依赖项注入(inject)来执行此操作,但我想不出一种方法来测试新的UNUserNotificationCenterAPI。我开始创建一个模拟对象来捕获通知请求:importFoundationimportUserNotificationsclassNotificationCenterMock:UNUserNotificationCenter{varrequest:UNNotificationRequest?=niloverridefuncadd(_request:UNNotificationRequest,withCo