コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }