public WorkflowTransition ToTransition() { var roles = Roles; if (!string.IsNullOrEmpty(Role)) { roles = new[] { Role }; } return(WorkflowTransition.When(Expression, roles)); }
public void Should_serialize_and_deserialize() { var workflow = new Workflow( Status.Draft, new Dictionary <Status, WorkflowStep> { [Status.Draft] = new WorkflowStep( new Dictionary <Status, WorkflowTransition> { [Status.Published] = WorkflowTransition.When("Expression", "Role1", "Role2") }, "#00ff00", NoUpdate.When("Expression", "Role1", "Role2")) }, new List <DomainId> { DomainId.NewGuid() }, "MyName"); var serialized = workflow.SerializeAndDeserialize(); serialized.Should().BeEquivalentTo(workflow); }
public void Should_serialize_and_deserialize() { var workflow = new Workflow( Status.Draft, new Dictionary <Status, WorkflowStep> { [Status.Draft] = new WorkflowStep( new Dictionary <Status, WorkflowTransition> { [Status.Published] = WorkflowTransition.When("Expression", "Role1", "Role2") }.ToReadonlyDictionary(), "#00ff00", NoUpdate.When("Expression", "Role1", "Role2")) }.ToReadonlyDictionary(), ReadonlyList.Create(DomainId.NewGuid()), "MyName"); var serialized = workflow.SerializeAndDeserialize(); Assert.Equal(workflow, serialized); }
public WorkflowTransition ToWorkflowTransition() { return WorkflowTransition.When(Expression, Roles); }