Ejemplo n.º 1
0
        public async Task JobsClient_MachineTypes_HappyPath()
        {
            var connection = new Mock <IConnection>();

            connection.Setup(c => c.Get <IList <JobMachine> >(ApiUrls.JobsMachineTypes(), null))
            .ReturnsAsync(() =>
            {
                var json = System.IO.File.ReadAllText("./Fixtures/Jobs_MachineTypes.json");
                return(JsonConvert.DeserializeObject <IList <JobMachine> >(json));
            });

            var logsConnection = new Mock <IConnection>();
            var jobsClient     = new JobsClient(connection.Object, logsConnection.Object);
            var result         = await jobsClient.MachineTypes();

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count);
        }
Ejemplo n.º 2
0
        public async Task JobsClient_MachineTypes_With_Filter()
        {
            var connection = new Mock <IConnection>();

            connection.Setup(c => c.Get <IList <JobMachine> >(ApiUrls.JobsMachineTypes(), It.IsAny <IDictionary <string, string> >()))
            .ReturnsAsync(() =>
            {
                var json = System.IO.File.ReadAllText("./Fixtures/Jobs_MachineTypes.json");
                return(JsonConvert.DeserializeObject <IList <JobMachine> >(json));
            });

            var logsConnection = new Mock <IConnection>();
            var jobsClient     = new JobsClient(connection.Object, logsConnection.Object);
            var result         = await jobsClient.MachineTypes(new MachineTypeFilter()
            {
                Cluster     = "1sdf",
                MachineType = MachineType.K80,
                Region      = Region.Europe_AMS1,
                IsBusy      = false
            });

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count);
        }