public void ReturnCorrectDeleteEventCommand()
        {
            var com = new DeleteEventDomainCommand(1);

            Assert.AreEqual(com.Command, DeleteSpCommandPattern.DeleteEvent);
            Assert.NotNull(com.Id);
            Assert.AreEqual(com.Id, 1);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task <DomainCommandResponse> Handle(DeleteEventDomainCommand request, CancellationToken cancellationToken)
        {
            try
            {
                this.UnitOfWork.EventRepository.Delete(request.ProjectedAs <Event>());

                var retResp = new DomainCommandResponse
                {
                    IsSuccess = true,
                    Message   = "Entity was Deleted",
                    Object    = request
                };

                return(await Task.FromResult(retResp));
            }
            catch (Exception ex)
            {
                var ret = new DomainCommandResponse {
                    Message = ex.Message
                };
                return(await Task.FromResult(ret));
            }
        }