Ejemplo n.º 1
0
        public void DoesNotNotifyWhenNoChanges_DataInMessages()
        {
            Guid messageId = Guid.NewGuid();

            Message existingMessage = new Message(messageId, "testSource", MessageType.info, "testText", string.Empty);
            Message newMessage      = new Message(messageId, "testSource", MessageType.info, "testText", string.Empty);

            _advisoryChangedNotifier.Handle(CreateEntityStateWithMessages(existingMessage), CreateTlsRptRecordsEvaluatedWithMessages(newMessage));

            A.CallTo(() => _messageDispatcher.Dispatch(A <Common.Messaging.Abstractions.Message> .Ignored, A <string> .Ignored)).MustNotHaveHappened();
        }
Ejemplo n.º 2
0
        public void DoesNotNotifyWhenMessageAreSameIdButDifferentMessageType()
        {
            Guid id = Guid.NewGuid();

            Message existingMessage = new Message(id, "testSource", MessageType.warning, "testText1", string.Empty);
            Message newMessage      = new Message(id, "testSource text has changed!", MessageType.error, "testText2", string.Empty);

            _advisoryChangedNotifier.Handle(CreateEntityStateWithMessages(existingMessage), CreateTlsRptRecordsEvaluatedWithMessages(newMessage));

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryAdded> ._, A <string> ._)).MustNotHaveHappened();
            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryRemoved> ._, A <string> ._)).MustNotHaveHappened();
        }
Ejemplo n.º 3
0
        public void NotifiesWhenMessageDisplayChanges_DataInRecords()
        {
            Message existingMessage = new Message(Guid.NewGuid(), "testSource", MessageType.info, "testText", string.Empty, MessageDisplay.Prompt);
            Message newMessage      = new Message(Guid.NewGuid(), "testSource", MessageType.info, "testText", string.Empty);

            _advisoryChangedNotifier.Handle(CreateEntityStateWithRecords(existingMessage), CreateTlsRptRecordsEvaluatedWithRecords(newMessage));

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryAdded> ._, A <string> ._)).MustHaveHappenedOnceExactly();
            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryAdded> .That.Matches(x => x.Messages.First().MessageDisplay == TlsRpt.Entity.Entity.Notifications.MessageDisplay.Standard), A <string> ._)).MustHaveHappenedOnceExactly();

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryRemoved> ._, A <string> ._)).MustNotHaveHappened();
        }
Ejemplo n.º 4
0
        public void NotifiesWhenMessageRemoved_DataInRecords()
        {
            Guid messageId = Guid.NewGuid();

            Message existingMessage1 = new Message(messageId, "testSource1", MessageType.info, "testText1", string.Empty);
            Message existingMessage2 = new Message(Guid.NewGuid(), "testSource2", MessageType.info, "testText2", string.Empty);

            Message newMessage = new Message(messageId, "testSource1", MessageType.info, "testText1", string.Empty);

            _advisoryChangedNotifier.Handle(CreateEntityStateWithRecords(existingMessage1, existingMessage2), CreateTlsRptRecordsEvaluatedWithRecords(newMessage));

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryAdded> ._, A <string> ._)).MustNotHaveHappened();

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryRemoved> ._, A <string> ._)).MustHaveHappenedOnceExactly();
            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsRptAdvisoryRemoved> .That.Matches(x => x.Messages.First().Text == "testText2"), A <string> ._)).MustHaveHappenedOnceExactly();
        }