public async void TestSubmitFile_NoCookie()
        {
            var p   = pb.Build();
            var ret = await p.SubmitFileInternal("", "", "");

            ret.Should().Be(255);
        }
示例#2
0
        public async void TestLogin_Failed()
        {
            var ret = await pb.Build().LoginInternal("dummyuser", "dummypass");

            pb.DataMock.Verify(d => d.SaveSession(It.IsAny <string>()), Times.Never());
            ret.Should().Be(1);
        }
示例#3
0
        public async void TestLatest_NoCookie()
        {
            var p   = pb.Build();
            var ret = await p.Latest();

            ret.Should().Be(255);
        }
示例#4
0
 public async void TestRestore_NoArgs()
 {
     pb.Build()
     .Invoking(p => p.RestoreInternal())
     .Should()
     .ThrowExactly <ArgumentException>()
     .WithMessage("Error: must use either url or id");
 }
示例#5
0
        public void TestAdd_Failed()
        {
            var file = Path.GetTempFileName();

            File.Delete(file);
            pb.Build().Add("http://example.com", "1001", file)
            .Should().Be(1);
            pb.DataMock.Verify(d => d.SaveSource(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <byte[]>()), Times.Never());
        }
示例#6
0
        public override void RunJob(
            string projectRoot,
            ProjectConfig project,
            ProjectBuildTarget target,
            ProjectBuildJob job)
        {
            string old = Directory.GetCurrentDirectory();

            Directory.SetCurrentDirectory(projectRoot);



            ProgramBuilder.Build(job.Arguments);



            if (job.Arguments.TryGetValue("export:labels", out string headerFiles))
            {
                string   headerFile = Path.Combine(projectRoot, "header.vhlheader");
                string[] list       = headerFiles.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).
                                      Select(x => x.Trim()).
                                      ToArray();

                BuildJobMakeHeader.MakeHeader(headerFile, list);
            }

            Directory.SetCurrentDirectory(old);
        }
示例#7
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                CommandLine.Usage();
                return;
            }

            CommandLine cmd = new CommandLine(args);

            if (!File.Exists(cmd.InputFilePath))
            {
                Console.WriteLine(
                    $"A megadott file: {cmd.InputFilePath} nem létezik! Ellenőrizze, hogy helyesen adta-e meg!");
                return;
            }
            if (cmd.InputType == null || cmd.InputType.ToUpper() != "BAS" && cmd.InputType.ToUpper() != "Z80")
            {
                Console.WriteLine(
                    $"A megadott bemeneti file típus: {cmd.InputType} érvénytelen! A típus csak 'Z80', vagy 'bas' lehet!");
                return;
            }

            ProgramBuilder builder = CreateBuilder(cmd);

            if (builder == null)
            {
                return;
            }

            builder.BuildMessageSent += Builder_BuildMessageSent;
            builder.Build();
            builder.BuildMessageSent -= Builder_BuildMessageSent;
        }
示例#8
0
        public async void TestSubmit_Latest_Exist()
        {
            var todays = new ProblemsSubmission
            {
                Id            = 101,
                ExecutionTime = 100,
                Length        = 11344,
                Language      = "C# (Mono 4.6.2.0)",
                UserId        = "naminodarie",
                Point         = 100,
                ContestId     = "contest02",
                ProblemId     = "contest02_a",
                Result        = "AC",
                DateTime      = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(9)).Date.AddDays(1).AddSeconds(-1),
            };

            pb.StreakMock
            .Setup(s => s.GetACSubmissionsAsync(It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(new[] {
                new ProblemsSubmission
                {
                    Id            = 13,
                    ExecutionTime = 1000,
                    Length        = 11344,
                    Language      = "C# (Mono 4.6.2.0)",
                    UserId        = "naminodarie",
                    Point         = 100,
                    ContestId     = "contest01",
                    ProblemId     = "contest01_a",
                    Result        = "AC",
                    DateTime      = new DateTime(1000, 1, 1, 11, 4, 13, 0),
                },
                new ProblemsSubmission
                {
                    Id            = 101,
                    ExecutionTime = 100,
                    Length        = 11344,
                    Language      = "C# (Mono 4.6.2.0)",
                    UserId        = "naminodarie",
                    Point         = 100,
                    ContestId     = "contest02",
                    ProblemId     = "contest02_a",
                    Result        = "AC",
                    DateTime      = new DateTime(2020, 1, 1, 15, 4, 13, 0),
                },
                todays,
            });
            var ret = await pb.Build().SubmitInternal(SourceOrder.None, false, "");

            ret.Should().Be((todays.ContestId, todays.ProblemId, todays.DateTime));
        }
示例#9
0
        public static string Compile(
            string file,
            string outputBuildFolder,
            string tempBuildFolder,
            bool cleanOutput,
            string[] buildSteps)
        {
            BuilderSettings.BuildTempDirectory = Path.GetFullPath(tempBuildFolder);

            if (!Directory.Exists(outputBuildFolder))
            {
                Directory.CreateDirectory(outputBuildFolder);
            }

            Logger.LogMessage(
                LoggerSystems.HlIntegration,
                "Current Working Dir: " + AppRootHelper.AppRoot
                );

            Logger.LogMessage(
                LoggerSystems.HlIntegration,
                "Vis API Build Result Directory: " + Path.GetFullPath(outputBuildFolder)
                );

            if (!Directory.Exists(outputBuildFolder))
            {
                Directory.CreateDirectory(outputBuildFolder);
            }

            BuilderSettings bs = new BuilderSettings();

            bs.CleanBuildOutput = cleanOutput;
            bs.EntryFiles       = new[] { file };
            bs.Steps            = buildSteps;
            ProgramBuilder.Build(bs);

            string buildOut = Path.Combine(
                Path.GetDirectoryName(file),
                Path.GetFileNameWithoutExtension(file) + ".vbin"
                );

            string buildInfo = Path.Combine(
                Path.GetDirectoryName(file),
                Path.GetFileNameWithoutExtension(file) + ".vbin.linkertext"
                );

            string buildTarget = Path.Combine(outputBuildFolder, Path.GetFileNameWithoutExtension(file) + ".vbin");

            string infoTarget = Path.Combine(
                outputBuildFolder,
                Path.GetFileNameWithoutExtension(file) + ".vbin.linkertext"
                );

            if (File.Exists(buildTarget))
            {
                File.Delete(buildTarget);
            }

            if (File.Exists(infoTarget))
            {
                File.Delete(infoTarget);
            }

            File.Move(buildOut, buildTarget);

            if (File.Exists(buildInfo))
            {
                File.Move(buildInfo, infoTarget);
            }

            return(buildTarget);
        }