Example #1
0
        public async Task RevokeClient_should_create_events_and_update_state()
        {
            var command = new RevokeClient {
                Id = clientId
            };

            await ExecuteCreateAsync();
            await ExecuteAttachClientAsync();

            var result = await sut.ExecuteAsync(CreateCommand(command));

            result.ShouldBeEquivalent(sut.Snapshot);

            Assert.False(sut.Snapshot.Clients.ContainsKey(clientId));

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new AppClientRevoked {
                Id = clientId
            })
                );
        }
 private void RevokeClient(RevokeClient command)
 {
     Raise(command, new AppClientRevoked());
 }
Example #3
0
 public void RevokeClient(RevokeClient command)
 {
     RaiseEvent(SimpleMapper.Map(command, new AppClientRevoked()));
 }
Example #4
0
        public void CanRevoke_should_throw_execption_if_client_id_is_null()
        {
            var command = new RevokeClient();

            Assert.Throws <ValidationException>(() => GuardAppClients.CanRevoke(clients, command));
        }
 protected Task On(RevokeClient command, CommandContext context)
 {
     return(handler.UpdateAsync <AppDomainObject>(context, a => a.RevokeClient(command)));
 }