예제 #1
0
        public async Task JobsClient_ArtifactsList_HappyPath()
        {
            var connection = new Mock <IConnection>();

            connection.Setup(c => c.Get <IList <Artifact> >(ApiUrls.JobsArtifactsList("j123abc"), null))
            .ReturnsAsync(() =>
            {
                var json = System.IO.File.ReadAllText("./Fixtures/Jobs_ArtifactsList.json");
                return(JsonConvert.DeserializeObject <IList <Artifact> >(json));
            });
            var logsConnection = new Mock <IConnection>();
            var jobsClient     = new JobsClient(connection.Object, logsConnection.Object);
            var result         = await jobsClient.ArtifactsList("j123abc");

            Assert.AreEqual(2, result.Count);
        }
예제 #2
0
        public async Task JobsClient_ArtifactsList_With_Parameters()
        {
            var connection = new Mock <IConnection>();

            connection.Setup(c => c.Get <IList <Artifact> >(ApiUrls.JobsArtifactsList("j123abc"), It.IsAny <IDictionary <string, string> >()))
            .ReturnsAsync(() =>
            {
                var json = System.IO.File.ReadAllText("./Fixtures/Jobs_ArtifactsList.json");
                return(JsonConvert.DeserializeObject <IList <Artifact> >(json));
            });
            var logsConnection = new Mock <IConnection>();
            var jobsClient     = new JobsClient(connection.Object, logsConnection.Object);
            var result         = await jobsClient.ArtifactsList("j123abc", new ListArtifactsParameters()
            {
                Files = "myfiles*",
                Size  = true,
                Links = true,
            });

            Assert.AreEqual(2, result.Count);
        }