Exemplo n.º 1
0
        public async Task Should_not_send_an_event_no_existing_eventType()
        {
            var item    = new Data1();
            var removed = new SourceDataRemoved(item);

            The <IDataChangedEventRepository>().FindRemovedEvent(item).Returns((SourceDataRemoved)null);
            IRequestHandler <SourceDataRemoved> handler = Subject;
            await handler.Handle(removed, CancellationToken.None);

            await The <IMediator>().DidNotReceive().Send(Arg.Any <IRequest>(), Arg.Any <CancellationToken>());
        }
Exemplo n.º 2
0
        public async Task Should_send_event_for_added()
        {
            var item    = new Data1();
            var removed = new SourceDataRemoved(item);

            var eventInstance = new Data1Removed(item);

            The <IDataChangedEventRepository>().FindRemovedEvent(item).Returns(eventInstance);

            IRequestHandler <SourceDataRemoved> handler = Subject;

            var token = CancellationToken.None;
            await handler.Handle(removed, token);

            await The <IMediator>().Received().Send(eventInstance, token);
        }