Exemplo n.º 1
0
        public async Task on_condition_with_negation_must_call_next_interceptor_unless_predicate_returns_true()
        {
            var probe       = new InterceptorProbe();
            var onCondition = new JournalInterceptors.OnCondition(_ => false, probe, negate: true);

            await onCondition.InterceptAsync(null);

            probe.WasCalled.Should().BeTrue();
        }
Exemplo n.º 2
0
        public async Task on_condition_must_call_next_interceptor_unless_predicate_returns_false()
        {
            var probe       = new InterceptorProbe();
            var onCondition = new SnapshotStoreInterceptors.OnCondition((_, __) => false, probe);

            await onCondition.InterceptAsync(null, null);

            probe.WasCalled.Should().BeFalse();
        }
Exemplo n.º 3
0
        public async Task on_condition_must_accept_async_lambda()
        {
            var probe       = new InterceptorProbe();
            var onCondition = new JournalInterceptors.OnCondition(_ => Task.FromResult(true), probe);

            await onCondition.InterceptAsync(null);

            probe.WasCalled.Should().BeTrue();
        }
Exemplo n.º 4
0
        public async Task on_condition_must_accept_sync_lambda()
        {
            var probe       = new InterceptorProbe();
            var onCondition = new SnapshotStoreInterceptors.OnCondition((_, __) => true, probe);

            await onCondition.InterceptAsync(null, null);

            probe.WasCalled.Should().BeTrue();
        }
Exemplo n.º 5
0
        public async Task on_condition_must_pass_the_same_message_to_predicate()
        {
            var probe           = new InterceptorProbe();
            var expectedMessage = new Persistent("test");

            var onCondition = new JournalInterceptors.OnCondition(message =>
            {
                message.Should().BeSameAs(expectedMessage);
                return(false);
            }, probe);

            await onCondition.InterceptAsync(expectedMessage);
        }