public void Parse_should_yield_whole_file_type_results() { DISetup.SetupContainer(); var sb = new StringBuilder(); sb.AppendLine(@"on_game_start = {"); sb.AppendLine(@" events = {"); sb.AppendLine(@" dmm_mod_1_flag.1"); sb.AppendLine(@" }"); sb.AppendLine(@"}"); var args = new ParserArgs() { ContentSHA = "sha", ModDependencies = new List <string> { "1" }, File = "flags\\fake.txt", Lines = sb.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries), ModName = "fake" }; var parser = new Games.Stellaris.FlagsParser(new CodeParser(new Logger()), null); var result = parser.Parse(args).ToList(); result.Should().NotBeNullOrEmpty(); result.Count().Should().Be(1); for (int i = 0; i < 1; i++) { result[i].ContentSHA.Should().Be("sha"); result[i].Dependencies.First().Should().Be("1"); result[i].File.Should().Be("flags\\fake.txt"); switch (i) { case 0: result[i].Code.Trim().Should().Be(sb.ToString().Trim()); result[i].Id.Should().Be("fake.txt"); result[i].ValueType.Should().Be(Common.ValueType.WholeTextFile); break; default: break; } result[i].ModName.Should().Be("fake"); result[i].Type.Should().Be("flags\\txt"); } }
public void Parse_should_yield_binary_type_results() { DISetup.SetupContainer(); var args = new ParserArgs() { ContentSHA = "sha", ModDependencies = new List <string> { "1" }, File = "flags\\test.png", ModName = "fake" }; var parser = new Games.Stellaris.FlagsParser(new CodeParser(new Logger()), null); var result = parser.Parse(args).ToList(); result.Should().NotBeNullOrEmpty(); result.Count().Should().Be(1); for (int i = 0; i < 1; i++) { result[i].ContentSHA.Should().Be("sha"); result[i].Dependencies.First().Should().Be("1"); result[i].File.Should().Be("flags\\test.png"); switch (i) { case 0: result[i].Code.Trim().Should().BeNullOrEmpty(); result[i].Id.Should().Be("test"); result[i].ValueType.Should().Be(Common.ValueType.Binary); break; default: break; } result[i].ModName.Should().Be("fake"); result[i].Type.Should().Be("flags\\binary"); } }