Пример #1
0
        public WorkflowTransition ToTransition()
        {
            var roles = Roles;

            if (!string.IsNullOrEmpty(Role))
            {
                roles = new[] { Role };
            }

            return(WorkflowTransition.When(Expression, roles));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
 }