示例#1
0
        public void DoesNotNotifyWhenNoChanges()
        {
            Guid Id1 = Guid.NewGuid();
            Guid Id2 = Guid.NewGuid();

            DkimEntityState oldState = new DkimEntityState("", 0, DkimState.PollPending, DateTime.MinValue, DateTime.MinValue, DateTime.MaxValue, new List <DkimSelector>
            {
                CreateDkimSelector("selector1", new List <Message>
                {
                    new Message(Id1, "selector 1 record 1 message 1", string.Empty, MessageType.Info),
                    new Message(Id2, "selector 1 record 1 message 2", string.Empty, MessageType.Info)
                })
            });

            DkimRecordEvaluationResult newRecord = new DkimRecordEvaluationResult(null, new List <DkimSelectorResult>
            {
                CreateDkimSelectorResult("selector1", new List <DkimEvaluatorMessage>
                {
                    new DkimEvaluatorMessage(Id1, EvaluationErrorType.Info, "selector 1 record 1 message 1", string.Empty),
                    new DkimEvaluatorMessage(Id2, EvaluationErrorType.Info, "selector 1 record 1 message 2", string.Empty)
                })
            });

            _advisoryChangedNotifier.Handle(oldState, newRecord);

            A.CallTo(() => _messageDispatcher.Dispatch(A <Common.Messaging.Abstractions.Message> ._, A <string> ._)).MustNotHaveHappened();
        }
        public void DoesNotNotifyWhenMessageAreSameIdButDifferentMessage()
        {
            Guid messageId = Guid.NewGuid();

            string errorMessage  = "An error has occured";
            string errorMessage2 = "An error has occured 2";

            TlsRecords existingTlsRecords =
                CreateTlsRecords(
                    new TlsRecord(new TlsEvaluatedResult(messageId, EvaluatorResult.FAIL, errorMessage)));

            TlsRecords newTlsRecords =
                CreateTlsRecords(
                    new TlsRecord(new TlsEvaluatedResult(messageId, EvaluatorResult.FAIL, errorMessage2)));

            TlsEntityState existingState = CreateEntityStateWithMessages(existingTlsRecords);

            _advisoryChangedNotifier.Handle(existingState, CreateTlsResultsEvaluatedWithResults(newTlsRecords), new List <string> {
                "test.gov.uk"
            });

            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsAdvisoryAdded> ._, A <string> ._, A <string> ._)).MustNotHaveHappened();
            A.CallTo(() => _messageDispatcher.Dispatch(A <TlsAdvisoryRemoved> ._, A <string> ._, A <string> ._)).MustNotHaveHappened();
        }
示例#3
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();
        }