Exemplo n.º 1
0
        public async Task NoWebHookAsync()
        {
            var store = new Mock <IWebHookStore>();

            store.Setup(s => s.GetApplicableWebHooksAsync(It.IsAny <IWebHookNotification>(), It.IsAny <CancellationToken>())).ReturnsAsync(new List <IWebHook>());
            var sender = new Mock <IWebHookSender>();

            var service = new DefaultNotificationProcessor(store.Object, sender.Object);
            await service.ProcessAsync(new WebHookNotification(), CancellationToken.None);

            sender.Verify(s => s.SendAsync(It.IsAny <IWebHookWorkItem>(), It.IsAny <CancellationToken>()), Times.Never);
        }
Exemplo n.º 2
0
        public async Task ArgNullAsync()
        {
            var store  = new Mock <IWebHookStore>();
            var sender = new Mock <IWebHookSender>();

            Assert.Throws <ArgumentNullException>(() => new DefaultNotificationProcessor(null, sender.Object));
            Assert.Throws <ArgumentNullException>(() => new DefaultNotificationProcessor(store.Object, null));
            Assert.Throws <ArgumentNullException>(() => new DefaultWebHookService(null));

            var service = new DefaultNotificationProcessor(store.Object, sender.Object);
            await Assert.ThrowsAsync <ArgumentNullException>(() => service.ProcessAsync(null, CancellationToken.None));
        }