예제 #1
0
        public async Task InvokesDeleteActivityAndTaskSignupsAsyncWithCorrectActivitySignupId()
        {
            var message = new UnregisterActivity {
                ActivitySignupId = 1
            };
            var dataAccess = new Mock <IAllReadyDataAccess>();
            var sut        = new UnregisterActivityHandler(dataAccess.Object, Mock.Of <IMediator>());
            await sut.Handle(message);

            dataAccess.Verify(x => x.DeleteActivityAndTaskSignupsAsync(message.ActivitySignupId));
        }
예제 #2
0
        public async Task PublishesUserUnenrollsWithCorrectData()
        {
            var message = new UnregisterActivity {
                ActivitySignupId = 1, UserId = "1"
            };
            var mediator = new Mock <IMediator>();

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

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