コード例 #1
0
        public void GetVendors_ParseGcpVendorInfo_MissingInvalidValues()
        {
            var json = @"{
							""id"": 3161347020215157000,
							""machineType"": ""projects / 492690098729 / machineTypes / custom - 1 - 1024"",
							""name"": ""aef-default-20170501t160547-7gh8?""
						}"                        ;

            var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor);
            var model      = (GcpVendorModel)vendorInfo.ParseGcpVendorInfo(json);

            Assert.Null(model);
        }
コード例 #2
0
        public void GetVendors_ParseGcpVendorInfo_Complete()
        {
            var json = @"{
							""id"": 3161347020215157000,
							""machineType"": ""projects / 492690098729 / machineTypes / custom - 1 - 1024"",
							""name"": ""aef-default-20170501t160547-7gh8"",
							""zone"": ""projects/492690098729/zones/us-central1-c""
						}"                        ;

            var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor);
            var model      = (GcpVendorModel)vendorInfo.ParseGcpVendorInfo(json);

            Assert.NotNull(model);
            Assert.True(model.Id == "3161347020215157000");
            Assert.True(model.MachineType == "custom - 1 - 1024");
            Assert.True(model.Name == "aef-default-20170501t160547-7gh8");
            Assert.True(model.Zone == "us-central1-c");
        }