Ejemplo n.º 1
0
        public async Task Basic()
        {
            var notifier1 = new Mock <INotifier>();
            var notifier2 = new Mock <INotifier>();

            var notifier = new CompositeNotifier(notifier1.Object, notifier2.Object);
            await notifier.NotifyCounterexampleAsync(new Counterexample(Mock.Of <MethodInfo>(), new List <Argument>()));

            notifier1.Verify(n => n.NotifyCounterexampleAsync(It.IsAny <Counterexample>()), Times.Once);
            notifier2.Verify(n => n.NotifyCounterexampleAsync(It.IsAny <Counterexample>()), Times.Once);
        }
        public void CompositeNotificationTest()
        {
            var _notifierType = new CompositeNotifier();
            FakeConsoleNotifier _consoleNotifier = new FakeConsoleNotifier();
            FakeEmailNotifier   _emailNotifier   = new FakeEmailNotifier();

            _notifierType.AddNotifierToList(_consoleNotifier);
            _notifierType.AddNotifierToList(_emailNotifier);
            _notifierType.TriggerNotification(BreachType.TOO_HIGH);
            Assert.True(_consoleNotifier.IsConsoleTriggerNotificationCalled);
            Assert.True(_emailNotifier.IsEmailTriggerNotificationCalled);
        }