コード例 #1
0
        public async Task InvokesDeleteEventAndTaskSignupsAsyncWithCorrectEventSignupId()
        {
            var message = new UnregisterEvent { EventSignupId = 1 };
            var dataAccess = new Mock<IAllReadyDataAccess>();
            var sut = new UnregisterEventHandler(dataAccess.Object, Mock.Of<IMediator>());
            await sut.Handle(message);

            dataAccess.Verify(x => x.DeleteEventAndTaskSignupsAsync(message.EventSignupId));
        }
コード例 #2
0
        public async Task PublishesUserUnenrollsWithCorrectData()
        {
            var message = new UnregisterEvent { EventSignupId = 1, UserId = "1" };
            var mediator = new Mock<IMediator>();

            var sut = new UnregisterEventHandler(Mock.Of<IAllReadyDataAccess>(), mediator.Object);
            await sut.Handle(message);

            mediator.Verify(x => x.PublishAsync(It.Is<UserUnenrolls>(y => y.EventId == message.EventSignupId && y.UserId == message.UserId)), Times.Once);
        }