public async Task ShouldDisableUser( TestableContext context, Handler handler ) { context.UoW.Plan <User>(context.Id()) .HasEvent <Events.Registered>(x => { x.UserName = context.Id(); x.GivenName = "test"; x.Password = "******"; }); var command = new Commands.Disable { UserName = context.Id() }; await handler.Handle(command, context).ConfigureAwait(false); context.UoW.Check <User>(context.Id()).Raised <Events.Disabled>(); }
public async Task Handle(Commands.Disable command, IMessageHandlerContext ctx) { var user = await ctx.For <User>().Get(command.UserName).ConfigureAwait(false); user.Disable(); }