protected virtual void Assert(IExecuteWatchResponse response, string watchId)
        {
            response.IsValid.Should().BeTrue();
            response.WatchRecord.Should().NotBeNull();
            response.WatchRecord.WatchId.Should().Be(watchId);
            response.WatchRecord.State.Should().NotBeNull().And.Be(ActionExecutionState.Executed);
            response.WatchRecord.TriggerEvent.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Type.Should().Be("manual");
            response.WatchRecord.TriggerEvent.TriggeredTime.Should().Be(_triggeredDateTime);
            response.WatchRecord.TriggerEvent.Manual.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.ScheduledTime.Should().Be(_triggeredDateTime);

            response.WatchRecord.Result.Should().NotBeNull();
            response.WatchRecord.Result.Condition.Should().NotBeNull();
            response.WatchRecord.Result.Condition.Type.Should().Be(ConditionType.Always);
            response.WatchRecord.Result.Condition.Status.Should().Be(Status.Success);
            response.WatchRecord.Result.Condition.Met.Should().BeTrue();

            response.WatchRecord.Result.Actions.Should().NotBeNullOrEmpty();
            response.WatchRecord.Result.Actions.Count().Should().Be(4);

            var inputContainer = response.WatchRecord.Input as IInputContainer;
            inputContainer.Should().NotBeNull();
            inputContainer.Search.Should().NotBeNull();

            response.WatchRecord.Metadata.Should().NotBeNull();
            response.WatchRecord.Metadata.Should().Contain("foo", "bar");

            var emailAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "email_admin").FirstOrDefault();
            emailAction.Should().NotBeNull();
            emailAction.Type.Should().Be(ActionType.Email);
            emailAction.Status.Should().Be(Status.Simulated);
            emailAction.Email.Should().NotBeNull();
            emailAction.Email.Message.SentDate.Should().HaveValue();

            var indexAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "index_action").FirstOrDefault();
            indexAction.Should().NotBeNull();
            indexAction.Type.Should().Be(ActionType.Index);
            indexAction.Status.Should().Be(Status.Success);
            indexAction.Index.Response.Should().NotBeNull();
            indexAction.Index.Response.Index.Should().Be("test");
            indexAction.Index.Response.Type.Should().Be("doctype2");
            indexAction.Index.Response.Created.Should().BeTrue();
            indexAction.Index.Response.Version.Should().Be(1);

            var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging_action").FirstOrDefault();
            loggingAction.Should().NotBeNull();
            loggingAction.Type.Should().Be(ActionType.Logging);
            loggingAction.Status.Should().Be(Status.Success);
            loggingAction.Logging.LoggedText.Should().Be("hello from nest");

            var webhookAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "webhook_action").FirstOrDefault();
            webhookAction.Should().NotBeNull();
            webhookAction.Type.Should().Be(ActionType.Webhook);
            webhookAction.Status.Should().Be(Status.Simulated);
            webhookAction.Webhook.Should().NotBeNull();

            response.WatchRecord.Result.ExecutionTime.Should().HaveValue();
        }
 protected virtual void Assert(IExecuteWatchResponse response, string watchId)
 {
     response.WatchRecord.Result.Actions.Should().NotBeNullOrEmpty();
     response.WatchRecord.Result.Actions.Count().Should().Be(1);
     var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging_action").FirstOrDefault();
     loggingAction.Should().NotBeNull();
     loggingAction.Type.Should().Be(ActionType.Logging);
     loggingAction.Status.Should().Be(Status.Throttled);
     loggingAction.Reason.Should().NotBeNullOrEmpty();
 }
示例#3
0
        protected virtual void Assert(IExecuteWatchResponse response, string watchId)
        {
            response.WatchRecord.Result.Actions.Should().NotBeNullOrEmpty();
            response.WatchRecord.Result.Actions.Count().Should().Be(1);
            var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging_action").FirstOrDefault();

            loggingAction.Should().NotBeNull();
            loggingAction.Type.Should().Be(ActionType.Logging);
            loggingAction.Status.Should().Be(Status.Throttled);
            loggingAction.Reason.Should().NotBeNullOrEmpty();
        }
        protected virtual void Assert(IExecuteWatchResponse response)
        {
            response.IsValid.Should().BeTrue();
            response.WatchRecord.TriggerEvent.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.TriggeredTime.Should().Be(_scheduledTime);
            response.WatchRecord.TriggerEvent.Manual.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.ScheduledTime.Should().Be(_scheduledTime);

            response.WatchRecord.Result.Input.Type.Should().Be(InputType.Simple);
            response.WatchRecord.Result.Input.Payload.Should().NotBeEmpty();
            response.WatchRecord.Result.Input.Payload["foo"].As <string>().Should().Be("bar");
            response.WatchRecord.Result.Condition.Met.Should().BeTrue();
            response.WatchRecord.Result.Actions.Should().NotBeEmpty();

            var emailAction = response.WatchRecord.Result.Actions.FirstOrDefault(a => a.Id == "email_admin");

            emailAction.Should().NotBeNull();
        }
示例#5
0
        public override void Fluent()
        {
            var watchId = PutWatch();
            IExecuteWatchResponse executeWatch = null;

            for (var i = 0; i < 2; i++)
            {
                executeWatch = this.Client.ExecuteWatch(watchId, w => w
                                                        .TriggerData(te => te
                                                                     .ScheduledTime(_triggeredDateTime)
                                                                     .TriggeredTime(_triggeredDateTime)
                                                                     )
                                                        .AlternativeInput(x => x.Add("foo", "bar"))
                                                        .IgnoreCondition()
                                                        .RecordExecution(true)
                                                        );
            }

            Assert(executeWatch, watchId);
        }
 protected virtual void Assert(IExecuteWatchResponse response, string watchId)
 {
     response.IsValid.Should().BeTrue();
     response.WatchRecord.Should().NotBeNull();
     response.WatchRecord.WatchId.Should().Be(watchId);
     response.WatchRecord.Result.Should().NotBeNull();
     response.WatchRecord.Result.Input.Should().NotBeNull();
     response.WatchRecord.Result.Input.Status.Should().Be(Status.Success);
     response.WatchRecord.Result.Input.Should().NotBeNull();
     response.WatchRecord.Result.Input.Payload.Should().NotBeNull();
     response.WatchRecord.Result.Input.Payload.Should().NotBeEmpty().And.ContainKey("count");
     Convert.ToInt32(response.WatchRecord.Result.Input.Payload["count"]).Should().Be(1);
     response.WatchRecord.Result.Condition.Should().NotBeNull();
     response.WatchRecord.Result.Condition.Status.Should().Be(Status.Success);
     response.WatchRecord.Result.Condition.Met.Should().BeTrue();
     response.WatchRecord.Result.Actions.Should().NotBeEmpty().And.HaveCount(1);
     var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging").FirstOrDefault();
     loggingAction.Should().NotBeNull();
     loggingAction.Type.Should().Be(ActionType.Logging);
     loggingAction.Status.Should().Be(Status.Success);
     loggingAction.Logging.LoggedText.Should().Be("foobar");
 }
        protected virtual void Assert(IExecuteWatchResponse response, string watchId)
        {
            response.IsValid.Should().BeTrue();
            response.WatchRecord.Should().NotBeNull();
            response.WatchRecord.WatchId.Should().Be(watchId);
            response.WatchRecord.Result.Should().NotBeNull();
            response.WatchRecord.Result.Input.Should().NotBeNull();
            response.WatchRecord.Result.Input.Status.Should().Be(Status.Success);
            response.WatchRecord.Result.Input.Should().NotBeNull();
            response.WatchRecord.Result.Input.Payload.Should().NotBeNull();
            response.WatchRecord.Result.Input.Payload.Should().NotBeEmpty().And.ContainKey("count");
            Convert.ToInt32(response.WatchRecord.Result.Input.Payload["count"]).Should().Be(1);
            response.WatchRecord.Result.Condition.Should().NotBeNull();
            response.WatchRecord.Result.Condition.Status.Should().Be(Status.Success);
            response.WatchRecord.Result.Condition.Met.Should().BeTrue();
            response.WatchRecord.Result.Actions.Should().NotBeEmpty().And.HaveCount(1);
            var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging").FirstOrDefault();

            loggingAction.Should().NotBeNull();
            loggingAction.Type.Should().Be(ActionType.Logging);
            loggingAction.Status.Should().Be(Status.Success);
            loggingAction.Logging.LoggedText.Should().Be("foobar");
        }
示例#8
0
        public override void ObjectInitializer()
        {
            var watchId = PutWatch();
            IExecuteWatchResponse executeWatch = null;

            for (var i = 0; i < 2; i++)
            {
                executeWatch = this.Client.ExecuteWatch(new ExecuteWatchRequest(watchId)
                {
                    TriggerData = new ScheduleTriggerEvent
                    {
                        ScheduledTime = _triggeredDateTime,
                        TriggeredTime = _triggeredDateTime
                    },
                    AlternativeInput = new Dictionary <string, object>
                    {
                        { "foo", "bar" }
                    },
                    IgnoreCondition = true,
                    RecordExecution = true,
                });
            }
            Assert(executeWatch, watchId);
        }
        protected virtual void Assert(IExecuteWatchResponse response, string watchId)
        {
            response.IsValid.Should().BeTrue();
            response.WatchRecord.Should().NotBeNull();
            response.WatchRecord.WatchId.Should().Be(watchId);
            response.WatchRecord.State.Should().NotBeNull().And.Be(ActionExecutionState.Executed);
            response.WatchRecord.TriggerEvent.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Type.Should().Be("manual");
            response.WatchRecord.TriggerEvent.TriggeredTime.Should().Be(_triggeredDateTime);
            response.WatchRecord.TriggerEvent.Manual.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.ScheduledTime.Should().Be(_triggeredDateTime);

            response.WatchRecord.Result.Should().NotBeNull();
            response.WatchRecord.Result.Condition.Should().NotBeNull();
            response.WatchRecord.Result.Condition.Type.Should().Be(ConditionType.Always);
            response.WatchRecord.Result.Condition.Status.Should().Be(Status.Success);
            response.WatchRecord.Result.Condition.Met.Should().BeTrue();

            response.WatchRecord.Result.Actions.Should().NotBeNullOrEmpty();
            response.WatchRecord.Result.Actions.Count().Should().Be(4);

            var inputContainer = response.WatchRecord.Input as IInputContainer;

            inputContainer.Should().NotBeNull();
            inputContainer.Search.Should().NotBeNull();

            response.WatchRecord.Metadata.Should().NotBeNull();
            response.WatchRecord.Metadata.Should().Contain("foo", "bar");

            var emailAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "email_admin").FirstOrDefault();

            emailAction.Should().NotBeNull();
            emailAction.Type.Should().Be(ActionType.Email);
            emailAction.Status.Should().Be(Status.Simulated);
            emailAction.Email.Should().NotBeNull();
            emailAction.Email.Message.SentDate.Should().HaveValue();

            var indexAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "index_action").FirstOrDefault();

            indexAction.Should().NotBeNull();
            indexAction.Type.Should().Be(ActionType.Index);
            indexAction.Status.Should().Be(Status.Success);
            indexAction.Index.Response.Should().NotBeNull();
            indexAction.Index.Response.Index.Should().Be("test");
            indexAction.Index.Response.Type.Should().Be("doctype2");
            indexAction.Index.Response.Created.Should().BeTrue();
            indexAction.Index.Response.Version.Should().Be(1);


            var loggingAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "logging_action").FirstOrDefault();

            loggingAction.Should().NotBeNull();
            loggingAction.Type.Should().Be(ActionType.Logging);
            loggingAction.Status.Should().Be(Status.Success);
            loggingAction.Logging.LoggedText.Should().Be("hello from nest");

            var webhookAction = response.WatchRecord.Result.Actions.Where(a => a.Id == "webhook_action").FirstOrDefault();

            webhookAction.Should().NotBeNull();
            webhookAction.Type.Should().Be(ActionType.Webhook);
            webhookAction.Status.Should().Be(Status.Simulated);
            webhookAction.Webhook.Should().NotBeNull();

            response.WatchRecord.Result.ExecutionTime.Should().HaveValue();
        }
        protected virtual void Assert(IExecuteWatchResponse response)
        {
            response.IsValid.Should().BeTrue();
            response.WatchRecord.TriggerEvent.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.Should().NotBeNull();
            response.WatchRecord.TriggerEvent.Manual.Schedule.ScheduledTime.Should().HaveValue();

            response.WatchRecord.Result.Input.Type.Should().Be(InputType.Simple);
            response.WatchRecord.Result.Input.Payload.Should().NotBeEmpty();
            response.WatchRecord.Result.Input.Payload["foo"].As<string>().Should().Be("bar");
            response.WatchRecord.Result.Condition.Met.Should().BeTrue();
            response.WatchRecord.Result.Actions.Should().NotBeEmpty();

            var emailAction = response.WatchRecord.Result.Actions.FirstOrDefault(a => a.Id == "email_admin");
            emailAction.Should().NotBeNull();
        }