Exemple #1
0
        public async Task on_type_must_not_call_next_interceptor_when_message_does_not_correspond_to_described_rules()
        {
            var probe   = new InterceptorProbe();
            var onType  = new JournalInterceptors.OnType(typeof(SubclassMessage), probe);
            var message = new Persistent(new SpecificMessage());

            await onType.InterceptAsync(message);

            probe.WasCalled.Should().BeFalse();
        }
Exemple #2
0
        public async Task on_type_must_call_next_interceptor_when_message_is_implements_awaited_interface_type()
        {
            var probe   = new InterceptorProbe();
            var onType  = new JournalInterceptors.OnType(typeof(IMessageWithInterface), probe);
            var message = new Persistent(new MessageWithInterface());

            await onType.InterceptAsync(message);

            probe.WasCalled.Should().BeTrue();
            probe.Message.Should().BeSameAs(message);
        }
Exemple #3
0
        public async Task on_type_must_call_next_interceptor_when_message_is_subclass_of_awaited_type()
        {
            var probe   = new InterceptorProbe();
            var onType  = new JournalInterceptors.OnType(typeof(SpecificMessage), probe);
            var message = new Persistent(new SubclassMessage());

            await onType.InterceptAsync(message);

            probe.WasCalled.Should().BeTrue();
            probe.Message.Should().BeSameAs(message);
        }