public async Task WhenImageNotFound_ThenAnnotationNotAdded() { var annotatedSet = CreateSet( new ImageLocator("unknown", "beos")); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); var computeEngineAdapter = new ComputeEngineAdapter(Defaults.GetCredential()); await LicenseLoader.LoadLicenseAnnotationsAsync( annotatedSet, computeEngineAdapter, CancellationToken.None); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); }
public async Task WhenImageNotFound_ThenAnnotationNotAdded( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { var annotatedSet = CreateSet( new ImageLocator("unknown", "beos")); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); var computeEngineAdapter = new ComputeEngineAdapter( await credential); await LicenseLoader.LoadLicenseAnnotationsAsync( annotatedSet, computeEngineAdapter, CancellationToken.None); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); }
public async Task WhenImageNotFoundButFromWindowsProject_ThenAnnotationIsAdded() { var annotatedSet = CreateSet( new ImageLocator("windows-cloud", "windows-95")); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); var computeEngineAdapter = new ComputeEngineAdapter(Defaults.GetCredential()); await LicenseLoader.LoadLicenseAnnotationsAsync( annotatedSet, computeEngineAdapter, CancellationToken.None); Assert.AreEqual(1, annotatedSet.LicenseAnnotations.Count()); var annotation = annotatedSet.LicenseAnnotations.Values.First(); Assert.AreEqual(OperatingSystemTypes.Windows, annotation.OperatingSystem); Assert.AreEqual(LicenseTypes.Spla, annotation.LicenseType); }
public async Task WhenImageFound_ThenAnnotationIsAdded( [Credential(Role = PredefinedRole.ComputeViewer)] ResourceTask <ICredential> credential) { var annotatedSet = CreateSet( new ImageLocator("windows-cloud", "family/windows-2019")); Assert.AreEqual(0, annotatedSet.LicenseAnnotations.Count()); var computeEngineAdapter = new ComputeEngineAdapter( await credential); await LicenseLoader.LoadLicenseAnnotationsAsync( annotatedSet, computeEngineAdapter, CancellationToken.None); Assert.AreEqual(1, annotatedSet.LicenseAnnotations.Count()); var annotation = annotatedSet.LicenseAnnotations.Values.First(); Assert.AreEqual(OperatingSystemTypes.Windows, annotation.OperatingSystem); Assert.AreEqual(LicenseTypes.Spla, annotation.LicenseType); }