/// <summary>Map a service model to the corresponding API model</summary> public StateSimulationApiModel(DeviceModel.StateSimulation state) : this() { if (state == null) { return; } this.Initial = state.InitialState; this.SimulationScript = new ScriptApiModel(state.Script); }
// Map service model to API model public static DeviceModelSimulation FromServiceModel(DeviceModel.StateSimulation value) { if (value == null) { return(null); } return(new DeviceModelSimulation { InitialState = value.InitialState, Interval = value.Interval.ToString("c"), Scripts = value.Scripts.Select(DeviceModelSimulationScript.FromServiceModel).Where(x => x != null).ToList() }); }
private DeviceModel.StateSimulation GetDeviceModelStateSimulation() { var deviceModelSimulation = new DeviceModel.StateSimulation { Interval = TimeSpan.FromSeconds(10), Scripts = new List <Script> { new Script { Type = ScriptInterpreter.JAVASCRIPT_SCRIPT, Path = "scripts" } } }; return(deviceModelSimulation); }