Esempio n. 1
0
        public void InlineMethodWay()
        {
            var config = new SimpleConfigStreamType {
                Divider = 0
            };
            var task = StreamProcessRunner.CreateAndExecuteWithNoFaultAsync(config, SimpleJob.Job1);

            task.Wait();
            Assert.IsTrue(task.Result.Failed, "the execution should not be successfull");
            Assert.IsInstanceOfType((task.Result.EndOfProcessTraceEvent?.Content as UnhandledExceptionStreamTraceContent)?.Exception, typeof(DivideByZeroException));
        }
Esempio n. 2
0
        public void FailEnsureKeyedNotSortedWithoutException()
        {
            #region ensure keyed not sorted without exception
            var inputList = new[] { 2, 1, 3, 4, 5 }.ToList();
            var outputList = new List <int>();

            var task = StreamProcessRunner.CreateAndExecuteWithNoFaultAsync(inputList, rootStream =>
            {
                rootStream
                .CrossApplyEnumerable("list elements", config => config)
                .EnsureKeyed("ensure keyed", i => i)
                .ThroughAction("collect values", outputList.Add);
            });
            task.Wait();

            Assert.IsTrue(task.Result.Failed);
            Assert.IsNotNull(task.Result.EndOfProcessTraceEvent.NodeName == "ensure keyed");
            Assert.IsNotNull(task.Result.StreamStatisticErrors.FirstOrDefault(i => i.NodeName == "ensure keyed"));
            CollectionAssert.AreEquivalent(new[] { 2 }.ToList(), outputList);
            #endregion
        }