public async Task Get() { var firstId = await _service.Put( new StateMachineInputDto() { Name = "first name", Body = "first body" }); var secondId = await _service.Put( new StateMachineInputDto() { Name = "second name", Body = "second body" }); var first = await _service.Get("first name"); var second = await _service.Get("second name"); var third = await _service.Get("third name"); Assert.True(first != null); Assert.Equal(firstId, first.Id); Assert.Equal("first name", first.Name); Assert.Equal("first body", first.Body); Assert.True(second != null); Assert.Equal(secondId, second.Id); Assert.Equal("second name", second.Name); Assert.Equal("second body", second.Body); Assert.True(third == null); }
public async Task <IActionResult> ChangeState([FromBody] PayloadModel <ServiceState> model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (model.Message == ServiceState.Subscribed) { var stateContext = stateMachineService.Get(model.AgentId); await stateContext.Start(model.BotId, model.AgentId); } return(Ok()); }
public async Task <ApiResponse <StateMachineOutputDto> > Get(string name) { var dto = await _stateMachineService.Get(name); if (dto == null) { return(ApiResponse.NotFound(Response, "state machine not found", dto)); } return(ApiResponse.OK(dto)); }