Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate test cases from regular Apex test #5871

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,106 +245,6 @@ public async Task WithSourceMappingEnabled_InstallPackageFromPMUIAndNoSourcesFou
}
}

[DataTestMethod]
[DynamicData(nameof(GetNetCoreTemplates), DynamicDataSourceType.Method)]
[Timeout(DefaultTimeout)]
public async Task InstallPackageToNetCoreProjectFromUI(ProjectTemplate projectTemplate)
{
EnsureVisualStudioHost();

using (var testContext = new ApexTestContext(VisualStudio, projectTemplate, Logger, addNetStandardFeeds: true))
{
// Arrange
var packageName = "NetCoreInstallTestPackage";
var packageVersion = "1.0.0";
await CommonUtility.CreatePackageInSourceAsync(testContext.PackageSource, packageName, packageVersion);

VisualStudio.AssertNoErrors();

// Act
CommonUtility.OpenNuGetPackageManagerWithDte(VisualStudio, Logger);
var nugetTestService = GetNuGetTestService();
var uiwindow = nugetTestService.GetUIWindowfromProject(testContext.Project);
uiwindow.InstallPackageFromUI(packageName, packageVersion);

// Assert
VisualStudio.AssertNuGetOutputDoesNotHaveErrors();
CommonUtility.AssertPackageReferenceExists(VisualStudio, testContext.Project, packageName, packageVersion, Logger);
}
}

[DataTestMethod]
[DynamicData(nameof(GetNetCoreTemplates), DynamicDataSourceType.Method)]
[Timeout(DefaultTimeout)]
public async Task UpdatePackageToNetCoreProjectFromUI(ProjectTemplate projectTemplate)
{
EnsureVisualStudioHost();

using (var testContext = new ApexTestContext(VisualStudio, projectTemplate, Logger, addNetStandardFeeds: true))
{
// Arrange
var packageName = "NetCoreUpdateTestPackage";
var packageVersion1 = "1.0.0";
var packageVersion2 = "2.0.0";

await CommonUtility.CreatePackageInSourceAsync(testContext.PackageSource, packageName, packageVersion1);
await CommonUtility.CreatePackageInSourceAsync(testContext.PackageSource, packageName, packageVersion2);

VisualStudio.AssertNoErrors();

// Act
CommonUtility.OpenNuGetPackageManagerWithDte(VisualStudio, Logger);
var nugetTestService = GetNuGetTestService();
var uiwindow = nugetTestService.GetUIWindowfromProject(testContext.Project);
uiwindow.InstallPackageFromUI(packageName, packageVersion1);
testContext.SolutionService.Build();
testContext.NuGetApexTestService.WaitForAutoRestore();

uiwindow.UpdatePackageFromUI(packageName, packageVersion2);
testContext.SolutionService.Build();
testContext.NuGetApexTestService.WaitForAutoRestore();

// Assert
VisualStudio.AssertNuGetOutputDoesNotHaveErrors();
CommonUtility.AssertPackageReferenceExists(VisualStudio, testContext.Project, packageName, packageVersion2, Logger);
}
}

[DataTestMethod]
[DynamicData(nameof(GetNetCoreTemplates), DynamicDataSourceType.Method)]
[Timeout(DefaultTimeout)]
public async Task UninstallPackageFromNetCoreProjectFromUI(ProjectTemplate projectTemplate)
{
EnsureVisualStudioHost();

using (var testContext = new ApexTestContext(VisualStudio, projectTemplate, Logger, addNetStandardFeeds: true))
{
// Arrange
var packageName = "NetCoreUninstallTestPackage";
var packageVersion = "1.0.0";

await CommonUtility.CreatePackageInSourceAsync(testContext.PackageSource, packageName, packageVersion);

VisualStudio.AssertNoErrors();

// Act
CommonUtility.OpenNuGetPackageManagerWithDte(VisualStudio, Logger);
var nugetTestService = GetNuGetTestService();
var uiwindow = nugetTestService.GetUIWindowfromProject(testContext.Project);
uiwindow.InstallPackageFromUI(packageName, packageVersion);
testContext.SolutionService.Build();
testContext.NuGetApexTestService.WaitForAutoRestore();

uiwindow.UninstallPackageFromUI(packageName);
testContext.SolutionService.Build();
testContext.NuGetApexTestService.WaitForAutoRestore();

// Assert
VisualStudio.AssertNuGetOutputDoesNotHaveErrors();
CommonUtility.AssertPackageReferenceDoesNotExist(VisualStudio, testContext.Project, packageName, Logger);
}
}

// There is a bug with VS or Apex where NetCoreConsoleApp and NetCoreClassLib create netcore 2.1 projects that are not supported by the sdk
// Commenting out any NetCoreConsoleApp or NetCoreClassLib template and swapping it for NetStandardClassLib as both are package ref.

Expand Down
Loading