Ejemplo n.º 1
0
        public static void AssertEventExists <TEvent>(this EventContext context, int count = 1, Func <IEvent, bool> additionalFilter = null, int?atLeast = null)
            where TEvent : IEvent
        {
            var recCount = context.GetAllReceivedEvents().Where(e => e.GetType() == typeof(TEvent) && (additionalFilter?.Invoke(e) ?? true)).Count();

            if (atLeast.HasValue)
            {
                recCount.Should().BeGreaterOrEqualTo(atLeast.Value);
            }
            else
            {
                recCount.Should().Be(count);
            }
        }