Esempio n. 1
0
        public void RestrictedSequence_T002()
        {
            using (var writer = new StringWriter())
            {
                var activity = new NoDelaySequence()
                {
                    Activities =
                    {
                        new WriteLine()
                        {
                            Text = "foo"
                        },
                        new WriteLine()
                        {
                            Text = "bar"
                        },
                        new Add <int, int, int>()
                        {
                            Left = 1, Right = 2
                        }
                    }
                };

                var valResults = activity.Validate();

                var invoker = new WorkflowInvoker(activity);
                invoker.Extensions.Add(writer);
                invoker.Invoke();

                Assert.That(
                    valResults.Errors.Count,
                    Is.Not.GreaterThan(0));

                Assert.That(
                    valResults.Warnings.Count,
                    Is.Not.GreaterThan(0));

                Assert.That(
                    writer.ToString(),
                    Is.EqualTo(string.Concat(
                                   "foo",
                                   Environment.NewLine,
                                   "bar",
                                   Environment.NewLine)));
            }
        }
Esempio n. 2
0
        public void RestrictedSequence_T001()
        {
            var activity = new NoDelaySequence()
            {
                Activities =
                {
                    new Delay()
                    {
                        Duration = TimeSpan.FromHours(1)
                    }
                }
            };

            var valResults = activity.Validate();

            Assert.That(
                valResults.Errors.Count,
                Is.EqualTo(1));
        }