Example #1
0
        public async Task Delete()
        {
            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 firstDelete = await _service.Delete("first name");

            var thirdDelete = await _service.Delete("third name");

            Assert.Equal(1, firstDelete);
            Assert.Equal(0, thirdDelete);

            var first = await _service.Get("first name");

            var second = await _service.Get("second name");

            Assert.True(first == null);
            Assert.True(second != null);
        }
Example #2
0
        public async Task <ApiResponse <DeleteResult> > Delete(string name)
        {
            var deleted = await _stateMachineService.Delete(name);

            var result = new DeleteResult(deleted);

            if (deleted <= 0)
            {
                return(ApiResponse.NotFound(Response, "state machine not found", result));
            }
            return(ApiResponse.OK(result));
        }