Exemple #1
0
        public void ShouldSendCommandAndDoNotReceiveNotification()
        {
            var commandHandler      = new TestPublishNotificationCommandHandler(_inMemomoryBus);
            var notificationHandler = new TestNotificationHandler(_messageRepository);

            var testMessage = new TestPublishNotificationCommand()
            {
                ResultFail    = true,
                MessageId     = Guid.NewGuid(),
                PublisherName = nameof(InMemoryBusTests),
                Timestamp     = DateTime.Now,
            };

            _inMemomoryBus.Receive(commandHandler);

            _inMemomoryBus.Send(testMessage);

            var _notifications = _messageRepository.GetAllMessageByType <TestNotificationFail>().ToList();

            Assert.AreEqual(0, _notifications.Count);


            _notifications = _messageRepository.GetAllMessageByType <TestNotificationSuccess>().ToList();

            Assert.AreEqual(0, _notifications.Count);
        }
Exemple #2
0
 public async Task TestNotificationAsync_StateUnderTest_ExpectedBehavior()
 {
     var l       = _mockRepository.Create <ILogger <TestNotificationHandler> >();
     var handler = new TestNotificationHandler(CreateNotificationClient(), l.Object);
     await handler.Handle(new(), default);