Skip to content

Commit f9f62b7

Browse files
committed
no mockserver
1 parent fda8e27 commit f9f62b7

1 file changed

Lines changed: 11 additions & 19 deletions

File tree

test/NuGet.Core.FuncTests/NuGet.XPlat.FuncTest/Package/Download/PackageDownloadRunnerTests.cs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,20 @@ public async Task RunAsync_WhenSourceMappingEnabled_PackageMapsToNoSource(bool a
700700
{
701701
// Arrange
702702
using var context = new SimpleTestPathContext();
703-
string srcDirectory = Path.Combine(context.PackageSource, "HttpSource");
704-
using var server = new FileSystemBackedV3MockServer(srcDirectory);
705-
PackageSource source = new(server.ServiceIndexUri, "Insecure");
703+
PackageSource source = new("http://contoso.test/v3/index.json", "Insecure");
706704
context.Settings.AddSource(source.Name, source.SourceUri.OriginalString);
707705
context.Settings.AddPackageSourceMapping(source.Name, "Contoso.Not.*");
708706
var settings = Settings.LoadSettingsGivenConfigPaths([context.Settings.ConfigPath]);
709707

710708
// package in source
711709
var id = "Contoso.Package";
712710
var version = "1.0.0";
713-
await SimpleTestPackageUtility.CreateFullPackageAsync(srcDirectory, id, version);
711+
712+
string expectedError = string.Format(
713+
CultureInfo.CurrentCulture,
714+
Strings.Error_HttpServerUsage,
715+
"package download",
716+
source);
714717

715718
// arguments
716719
var logger = new Mock<ILoggerWithColor>(MockBehavior.Loose);
@@ -732,11 +735,6 @@ public async Task RunAsync_WhenSourceMappingEnabled_PackageMapsToNoSource(bool a
732735
AllowInsecureConnections = allowInsecureConnections,
733736
};
734737

735-
if (allowInsecureConnections)
736-
{
737-
server.Start();
738-
}
739-
740738
// Act
741739
var exit = await PackageDownloadRunner.RunAsync(
742740
args,
@@ -748,22 +746,16 @@ public async Task RunAsync_WhenSourceMappingEnabled_PackageMapsToNoSource(bool a
748746
// Assert
749747
if (allowInsecureConnections)
750748
{
751-
exit.Should().Be(PackageDownloadRunner.ExitCodeSuccess);
752-
var installDir = Path.Combine(context.WorkingDirectory, id.ToLowerInvariant(), version);
753-
Directory.Exists(installDir).Should().BeTrue();
754-
File.Exists(Path.Combine(installDir, $"{id.ToLowerInvariant()}.{version}.nupkg")).Should().BeTrue();
749+
logger.Verify(
750+
l => l.LogError(expectedError),
751+
Times.Never);
755752
}
756753
else
757754
{
758755
exit.Should().Be(PackageDownloadRunner.ExitCodeError);
759-
string expectedError = string.Format(
760-
CultureInfo.CurrentCulture,
761-
Strings.Error_HttpServerUsage,
762-
"package download",
763-
source);
764756
logger.Verify(
765757
l => l.LogError(expectedError),
766-
Times.AtLeastOnce);
758+
Times.Once);
767759
}
768760
}
769761

0 commit comments

Comments
 (0)