コード例 #1
0
        public void ValidateOk()
        {
            var command = new CreateEventSourceCommand(name: "Evento", description: "Descrição evento"
                                                       , isActive: false);

            var handle = new CreateEventSourceHandler(_repository);

            var result = (CommandResult)handle.Handle(command);

            Assert.AreEqual(true, result.Ok);
        }
コード例 #2
0
ファイル: EventSourceService.cs プロジェクト: diegostan/OESP
        public void InsertEventSource(ApplicationContext app)
        {
            var commandEvent = new CreateEventSourceCommand(name: app.ApplicationName
                                                            , description: app.ApplicationDescription, isActive: app.IsRunning
                                                            , message: $"A aplicação {app.ApplicationName} foi encerrada.");

            using (var serviceScope = this.ServiceProvider.CreateScope())
            {
                _createEvent = serviceScope.ServiceProvider.GetRequiredService <CreateEventSourceHandler>();
                _createEvent.Handle(commandEvent);
            }

            SendMail(app, commandEvent);
        }
コード例 #3
0
ファイル: EventSourceService.cs プロジェクト: diegostan/OESP
        public void InsertEmailEventSource(ApplicationContext app, SendEmailCommand emailCommand, bool ok)
        {
            var commandOk = new CreateEventSourceCommand(name: app.ApplicationName
                                                         , description: app.ApplicationDescription, isActive: true
                                                         , message: $"Um email foi disparado para {emailCommand.EmailAddress} às {app.EventDateTime}.");

            var commandFail = new CreateEventSourceCommand(name: app.ApplicationName
                                                           , description: app.ApplicationDescription, isActive: false
                                                           , message: $"Houve uma falha ao disparar um email para {emailCommand.EmailAddress} às {app.EventDateTime}.");

            using (var serviceScope = this.ServiceProvider.CreateScope())
            {
                _createEvent = serviceScope.ServiceProvider.GetRequiredService <CreateEventSourceHandler>();
                if (ok)
                {
                    _createEvent.Handle(commandOk);
                }
                else
                {
                    _createEvent.Handle(commandFail);
                }
            }
        }