Beispiel #1
0
        public void RequestFluent()
        {
            var dt = DateTime.UtcNow;

            var result = this.Client.ExecuteWatch("my_watch", e => e
                                                  .AlternativeInput(a => a.Add("someKey", "SomeValue"))
                                                  .IgnoreCondition(false)
                                                  .RecordExecution(false)
                                                  .TriggerData(te => te
                                                               .ScheduledTime(dt)
                                                               .TriggeredTime(dt)
                                                               )
                                                  .ActionModes(a => a.Add("_all", ActionExecutionMode.ForceSimulate))
                                                  .SimulatedActions(SimulatedActions.Some("action1", "action2"))
                                                  );

            var expectedRequest = new
            {
                trigger_data = new
                {
                    scheduled_time = dt,
                    triggered_time = dt
                },
                ignore_condition  = false,
                record_execution  = false,
                alternative_input = new { someKey = "SomeValue" },
                action_modes      = new
                {
                    _all = "force_simulate"
                },
                simulated_actions = new[] { "action1", "action2" },
            };

            this.JsonEquals(expectedRequest, result);
        }
Beispiel #2
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     if (reader.TokenType == JsonToken.String)
     {
         return(SimulatedActions.All);
     }
     return(SimulatedActions.Some(serializer.Deserialize <List <string> >(reader)));
 }
Beispiel #3
0
        public void SimulatedSome()
        {
            var expectedRequest = new
            {
                simulated_actions = new [] { "action1", "action2" }
            };

            var result = this.Client.ExecuteWatch(new ExecuteWatchRequest("my_watch")
            {
                SimulatedActions = SimulatedActions.Some("action1", "action2")
            });

            this.JsonEquals(expectedRequest, result);
        }
        public void Request()
        {
            var dt = DateTime.UtcNow;

            var expectedRequest = new
            {
                trigger_data = new
                {
                    scheduled_time = dt,
                    triggered_time = dt
                },
                ignore_condition  = false,
                ignore_throttle   = true,
                record_execution  = false,
                alternative_input = new { someKey = "SomeValue" },
                action_modes      = new
                {
                    _all = "force_simulate"
                },
                simulated_actions = new[] { "action1", "action2" },
            };

            var result = this.Client.ExecuteWatch(new ExecuteWatchRequest("my_watch")
            {
                AlternativeInput = new Dictionary <string, object> {
                    { "someKey", "SomeValue" }
                },
                IgnoreCondition = false,
                RecordExecution = false,
                TriggerData     = new ScheduleTriggerEvent
                {
                    ScheduledTime = dt,
                    TriggeredTime = dt,
                },
                ActionModes = new Dictionary <string, ActionExecutionMode>
                {
                    { "_all", ActionExecutionMode.ForceSimulate }
                },
                SimulatedActions = SimulatedActions.Some("action1", "action2")
            });


            this.JsonEquals(expectedRequest, result);
        }