public void GetVendors_ParseAzureVendorInfo_MissingInvalidValues() { var json = @"{ ""location"": ""CentralUS"", ""name"": ""IMDS:Canary"", ""vmId"": ""5c08b38e-4d57-4c23-ac45-aca61037f084"" }" ; var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor); var model = (AzureVendorModel)vendorInfo.ParseAzureVendorInfo(json); Assert.Null(model); }
public void GetVendors_ParseAzureVendorInfo_InvalidJson() { var json = @"{ I am not valid json. Deal with it. ""location"": ""CentralUS"", ""name"": ""IMDSCanary"", ""vmId"": ""5c08b38e-4d57-4c23-ac45-aca61037f084"", ""vmSize"": ""Standard_DS2"" }" ; var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor); var model = (AzureVendorModel)vendorInfo.ParseAzureVendorInfo(json); Assert.Null(model); }
public void GetVendors_ParseAzureVendorInfo_Complete() { var json = @"{ ""location"": ""CentralUS"", ""name"": ""IMDSCanary"", ""vmId"": ""5c08b38e-4d57-4c23-ac45-aca61037f084"", ""vmSize"": ""Standard_DS2"" }" ; var vendorInfo = new VendorInfo(_configuration, _agentHealthReporter, _environment, _vendorHttpApiRequestor); var model = (AzureVendorModel)vendorInfo.ParseAzureVendorInfo(json); Assert.NotNull(model); Assert.True(model.Location == "CentralUS"); Assert.True(model.Name == "IMDSCanary"); Assert.True(model.VmId == "5c08b38e-4d57-4c23-ac45-aca61037f084"); Assert.True(model.VmSize == "Standard_DS2"); }