示例#1
0
        public void SequenceItemActionRun_ExpectFail()
        {
            /* 𝓐𝓻𝓻𝓪𝓷𝓰𝓮... */
            var testSequenceItem = new SequenceItem
            {
                command = "some-run-command",
                run     = new Run {
                    exec = "this is an invalid command"
                }
            };

            var dummyRunState = new RunState {
                YamlOptions = new YamlScript {
                    sequence_items = new[] { testSequenceItem }.ToList()
                }
            };

            var testSequenceItemAction = new SequenceItemRun(dummyRunState, testSequenceItem, null, new List <SequenceItem>());


            /* 𝓐𝓬𝓽 */
            var actual = testSequenceItemAction.ActionAsync(new CancellationToken()).Result;


            /* 𝓐𝓼𝓼𝓮𝓻𝓽 */
            Assert.True(testSequenceItemAction.IsFail);

            Assert.NotNull(testSequenceItemAction.Exception);

            Assert.Null(actual);
        }
示例#2
0
        public void SequenceItemActionRun_ExpectSuccess()
        {
            /* 𝓐𝓻𝓻𝓪𝓷𝓰𝓮... */
            var testSequenceItem = new SequenceItem
            {
                command = "test-cmd-script",
                run     = new Run {
                    exec = ExecutableFilename
                }
            };

            var dummyRunState = new RunState {
                YamlOptions = new YamlScript {
                    sequence_items = new[] { testSequenceItem }.ToList()
                }
            };

            var testSequenceItemAction = new SequenceItemRun(dummyRunState, testSequenceItem, null, new List <SequenceItem>());


            /* 𝓐𝓬𝓽 */
            var actual = (string)testSequenceItemAction.ActionAsync(new CancellationToken()).Result;


            /* 𝓐𝓼𝓼𝓮𝓻𝓽 */
            Assert.False(testSequenceItemAction.IsFail);

            Assert.Null(testSequenceItemAction.Exception);

            Assert.EndsWith(ExecutableExpectedResult, actual);
        }