Esempio n. 1
0
        public async Task GivenAStorageAccountVerifyPushAndSucceedWithBaseURI()
        {
            using (var packagesFolder = new TestFolder())
                using (var testContext = new AmazonS3TestContext())
                {
                    var baseUri    = new Uri("http://tempuri.org/abc/");
                    var fileSystem = new AmazonS3FileSystem(
                        testContext.LocalCache, testContext.Uri, baseUri,
                        testContext.Client, testContext.BucketName, ServerSideEncryptionMethod.None
                        );

                    testContext.FileSystem = fileSystem;

                    await testContext.InitAsync();

                    var testPackage = new TestNupkg("packageA", "1.0.0");
                    var zipFile     = testPackage.Save(packagesFolder.Root);

                    var result = await InitCommand.RunAsync(testContext.LocalSettings,
                                                            testContext.FileSystem,
                                                            enableCatalog : true,
                                                            enableSymbols : true,
                                                            log : testContext.Logger,
                                                            token : CancellationToken.None);

                    result &= await PushCommand.RunAsync(testContext.LocalSettings,
                                                         testContext.FileSystem,
                                                         new List <string>() { zipFile.FullName },
                                                         force : false,
                                                         skipExisting : false,
                                                         log : testContext.Logger);

                    result &= await ValidateCommand.RunAsync(testContext.LocalSettings,
                                                             testContext.FileSystem,
                                                             testContext.Logger);

                    result.Should().BeTrue();

                    // Check baseURIs
                    await BaseURITestUtil.VerifyBaseUris(testContext.FileSystem.Files.Values, baseUri);

                    await testContext.CleanupAsync();
                }
        }
Esempio n. 2
0
        public async Task BaseUri_VerifyBaseUriIsSetForAllFilesAsync()
        {
            // Arrange
            using (var packagesFolder = new TestFolder())
                using (var target = new TestFolder())
                    using (var cache = new LocalCache())
                    {
                        var outputRoot = Path.Combine(target.Root, "output");
                        var baseUri    = UriUtility.CreateUri("https://localhost:8080/testFeed/");

                        var log = new TestLogger();

                        var testPackage = new TestNupkg("packageA", "1.0.0");

                        var sleetConfig = TestUtility.CreateConfigWithLocal("local", outputRoot, baseUri.AbsoluteUri);

                        var sleetConfigPath = Path.Combine(target.Root, "sleet.config");
                        await JsonUtility.SaveJsonAsync(new FileInfo(sleetConfigPath), sleetConfig);

                        var zipFile = testPackage.Save(packagesFolder.Root);

                        var settings   = LocalSettings.Load(sleetConfigPath);
                        var fileSystem = FileSystemFactory.CreateFileSystem(settings, cache, "local");

                        // Act
                        var initSuccess = await InitCommand.RunAsync(settings, fileSystem, log);

                        var pushSuccess = await PushCommand.RunAsync(settings, fileSystem, new List <string>() { zipFile.FullName }, false, false, log);


                        // Assert
                        Assert.True(initSuccess, log.ToString());
                        Assert.True(pushSuccess, log.ToString());

                        var files = Directory.GetFiles(outputRoot, "*.json", SearchOption.AllDirectories);
                        await BaseURITestUtil.VerifyBaseUris(files, baseUri);
                    }
        }