Пример #1
0
        public void CanGetArtifact()
        {
            GithubActionsClient client = new GithubActionsClient(DataConstants.RepoOwnerUserName, DataConstants.RepoName);

            GithubArtifactInfo[] artifacts = client.ListArtifactInfos(DataConstants.RepoOwnerUserName, DataConstants.RepoName).ToArray();
            uint artifactId = artifacts[0].Id;
            GithubArtifactInfo artifactInfo = client.GetArtifactInfo(artifactId);

            artifactInfo.ShouldNotBeNull();
            Message.PrintLine(artifactInfo.ToJson(true));
        }
Пример #2
0
        public void CanDownloadArtifact()
        {
            GithubActionsClient client = new GithubActionsClient();

            GithubArtifactInfo[] artifacts = client.ListArtifactInfos(DataConstants.RepoOwnerUserName, DataConstants.RepoName).ToArray();
            artifacts.Length.ShouldBeGreaterThan(0, "No artifacts were returned");
            GithubArtifactInfo artifactInfo = artifacts.First();
            string             fileName     = $"./{nameof(CanDownloadArtifact)}.zip";
            FileInfo           fileInfo     = artifactInfo.DownloadTo(fileName);

            fileInfo.Exists.ShouldBeTrue("file doesn't exist after attempted download");

            Message.PrintLine("Artifact Size Unzipped: {0}, File Size Zipped: {1}", artifactInfo.SizeInBytes, fileInfo.Length);
            fileInfo.Delete();
            Pass(nameof(CanDownloadArtifact));
        }