using System; using System.Collections.Generic; using System.Linq; using GitHub.Runner.Worker; using Xunit; namespace GitHub.Runner.Common.Tests.Worker { public sealed class SaveStateFileCommandL0 : FileCommandTestBase { protected override IDictionary PostSetup() { var intraActionState = new Dictionary(); _executionContext.Setup(x => x.IntraActionState).Returns(intraActionState); return intraActionState; } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_DirectoryNotFound() { base.TestDirectoryNotFound(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_NotFound() { base.TestNotFound(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_EmptyFile() { base.TestEmptyFile(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Simple() { base.TestSimple(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Simple_SkipEmptyLines() { base.TestSimple_SkipEmptyLines(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Simple_EmptyValue() { base.TestSimple_EmptyValue(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Simple_MultipleValues() { base.TestSimple_MultipleValues(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Simple_SpecialCharacters() { base.TestSimple_SpecialCharacters(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Heredoc() { base.TestHeredoc(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Heredoc_EmptyValue() { base.TestHeredoc_EmptyValue(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Heredoc_SkipEmptyLines() { base.TestHeredoc_SkipEmptyLines(); } [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] public void SaveStateFileCommand_Heredoc_EdgeCases() { base.TestHeredoc_EdgeCases(); } [Theory] [Trait("Level", "L0")] [Trait("Category", "Worker")] // All of the following are not only valid, but quite plausible end markers. // Most are derived straight from the example at https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings #pragma warning disable format [InlineData("=EOF")][InlineData("==EOF")][InlineData("EO=F")][InlineData("EO==F")][InlineData("EOF=")][InlineData("EOF==")] [InlineData("