Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ocalles committed Nov 18, 2022
1 parent 7f91a08 commit a78a033
Showing 1 changed file with 25 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,6 @@ public class GivenThatWeWantToGetDependenciesViaDesignTimeBuild
[Fact]
public void ItShouldIgnoreAllDependenciesWithTypeNotEqualToPackageOrUnresolved()
{
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package2\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package3\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package2\\1.0.0");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\");
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\top.package1.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\top.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\top.package3.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\dependent.package1.10.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\dependent.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\dependent.package3.1.0.0.nupkg.sha512")) { }

string projectAssetsJsonPath = Path.GetTempFileName();
string projectCacheAssetsJsonPath = Path.GetTempFileName();
// project.assets.json
Expand Down Expand Up @@ -273,25 +254,6 @@ public void ItShouldIgnoreAllDependenciesWithTypeNotEqualToPackageOrUnresolved()
[Fact]
public void ItShouldIdentifyDefaultImplicitPackages()
{
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package2\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package3\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package2\\1.0.0");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\");
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\top.package1.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\top.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\top.package3.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\dependent.package1.10.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\dependent.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\dependent.package3.1.0.0.nupkg.sha512")) { }

string projectAssetsJsonPath = Path.GetTempFileName();
string projectCacheAssetsJsonPath = Path.GetTempFileName();
// project.assets.json
Expand Down Expand Up @@ -532,25 +494,6 @@ public void ItShouldIdentifyDefaultImplicitPackages()
[Fact]
public void ItShouldOnlyReturnPackagesInTheSpecifiedTarget()
{
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package2\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package3\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package2\\1.0.0");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\");
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\top.package1.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\top.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\top.package3.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\dependent.package1.10.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\dependent.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\dependent.package3.1.0.0.nupkg.sha512")) { }

string projectAssetsJsonPath = Path.GetTempFileName();
string projectCacheAssetsJsonPath = Path.GetTempFileName();
// project.assets.json
Expand Down Expand Up @@ -813,25 +756,6 @@ public void ItShouldOnlyReturnPackagesInTheSpecifiedTarget()
[Fact]
public void ItShouldOnlyReturnTopLevelPackages()
{
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package2\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package3\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package2\\1.0.0");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\");
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\top.package1.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\top.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\top.package3.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\dependent.package1.10.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\dependent.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\dependent.package3.1.0.0.nupkg.sha512")) { }

string projectAssetsJsonPath = Path.GetTempFileName();
string projectCacheAssetsJsonPath = Path.GetTempFileName();
// project.assets.json
Expand Down Expand Up @@ -1088,8 +1012,33 @@ private ResolvePackageAssets InitializeTask(out IEnumerable<PropertyInfo> inputP

task.BuildEngine = new MockBuildEngine();

CreateFolders();

return task;
}

private void CreateFolders()
{
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package2\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\top.package3\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package2\\1.0.0");
Directory.CreateDirectory("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\");
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package1\\1.0.0\\top.package1.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package2\\1.0.0\\top.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\top.package3\\1.0.0\\top.package3.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package1\\1.0.0\\dependent.package1.10.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package2\\1.0.0\\dependent.package2.1.0.0.nupkg.sha512")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\.nupkg.metadata")) { }
using (File.Create("C:\\.nuget\\packages\\dependent.package3\\1.0.0\\dependent.package3.1.0.0.nupkg.sha512")) { }

}
}
}

0 comments on commit a78a033

Please sign in to comment.