示例#1
0
        public async Task JobsClient_Create_HappyPath()
        {
            var connection = new Mock <IConnection>();

            connection.Setup(c => c.Post <Job>(ApiUrls.JobsCreate(), null, It.IsAny <object>(), null, null))
            .ReturnsAsync(() =>
            {
                var json = System.IO.File.ReadAllText("./Fixtures/Jobs_Create.json");
                return(JsonConvert.DeserializeObject <Job>(json));
            });

            var logsConnection = new Mock <IConnection>();
            var jobsClient     = new JobsClient(connection.Object, logsConnection.Object);
            var result         = await jobsClient.Create(new CreateJobRequest()
            {
                Container   = "http://dockerhub.com/mycontainer",
                MachineType = MachineType.P5000
            });

            Assert.IsNotNull(result);
        }