Skip to content

Commit

Permalink
Adjust Unit-Tests to Code-Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsfoni committed Dec 18, 2023
1 parent b995876 commit 0590e6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions CycloneDX.Tests/ProjectAssetsFileServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using NuGet.ProjectModel;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System.IO;

namespace CycloneDX.Tests
{
Expand Down Expand Up @@ -81,7 +82,7 @@ public void GetDotnetDependencys_PackageAsTopLevelAndTransitive(string framework
}));
var mockAssetReader = new Mock<IAssetFileReader>();
mockAssetReader
.Setup(m => m.Read(It.IsAny<string>()))
.Setup(m => m.Read(It.IsAny<Stream>(), It.IsAny<string>()))
.Returns(() =>
{
var nuGetFramework = new NuGet.Frameworks.NuGetFramework(framework, new Version(frameworkMajor, frameworkMinor, 0));
Expand Down Expand Up @@ -310,7 +311,7 @@ public void GetDotnetDependencys_MissingResolvedPackageVersion(string framework,
}));
var mockAssetReader = new Mock<IAssetFileReader>(MockBehavior.Strict);
mockAssetReader
.Setup(m => m.Read(It.IsAny<string>()))
.Setup(m => m.Read(It.IsAny<Stream>(), It.IsAny<string>()))
.Returns(() =>
{
var nuGetFramework = new NuGet.Frameworks.NuGetFramework(framework, new Version(frameworkMajor, frameworkMinor, 0));
Expand Down Expand Up @@ -455,7 +456,7 @@ public void GetDotnetDependencys_MissingDependencies(string framework, int frame
}));
var mockAssetReader = new Mock<IAssetFileReader>(MockBehavior.Strict);
mockAssetReader
.Setup(m => m.Read(It.IsAny<string>()))
.Setup(m => m.Read(It.IsAny<Stream>(), It.IsAny<string>()))
.Returns(() =>
{
var nuGetFramework = new NuGet.Frameworks.NuGetFramework(framework, new Version(frameworkMajor, frameworkMinor));
Expand Down
10 changes: 5 additions & 5 deletions CycloneDX.Tests/ProjectFileServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsDotne
{
var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ XFS.Path(@"c:\Project\Project.csproj"), "" },
{ XFS.Path(@"c:\Project\Project.csproj"), "<Project Sdk=\"Microsoft.NET.Sdk\" />" },
{ XFS.Path(@"c:\Project\obj\project.assets.json"), "" },
});
var mockDotnetUtilsService = new Mock<IDotnetUtilsService>();
Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFileWithoutRestor
{
var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ XFS.Path(@"c:\Project\Project.csproj"), "" },
{ XFS.Path(@"c:\Project\Project.csproj"), "<Project Sdk=\"Microsoft.NET.Sdk\" />" },
{ XFS.Path(@"c:\Project\obj\project.assets.json"), "" },
});
var mockDotnetUtilsService = new Mock<IDotnetUtilsService>();
Expand Down Expand Up @@ -129,7 +129,7 @@ public async Task GetProjectDotnetDependencys_WithProjectAssetsFile_ReturnsMulti
{
var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ XFS.Path(@"c:\Project\Project.csproj"), "" },
{ XFS.Path(@"c:\Project\Project.csproj"), "<Project Sdk=\"Microsoft.NET.Sdk\" />" },
{ XFS.Path(@"c:\Project\obj\project.assets.json"), "" },
});
var mockDotnetUtilsService = new Mock<IDotnetUtilsService>();
Expand Down Expand Up @@ -167,7 +167,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsDotnetDe
{
var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ XFS.Path(@"c:\Project\Project.csproj"), "" },
{ XFS.Path(@"c:\Project\Project.csproj"), "<Project Sdk=\"Microsoft.NET.Sdk\" />" },
{ XFS.Path(@"c:\Project\packages.config"), "" },
});
var mockDotnetUtilsService = new Mock<IDotnetUtilsService>();
Expand Down Expand Up @@ -207,7 +207,7 @@ public async Task GetProjectDotnetDependencys_WithPackagesConfig_ReturnsMultiple
{
var mockFileSystem = new MockFileSystem(new Dictionary<string, MockFileData>
{
{ XFS.Path(@"c:\Project\Project.csproj"), "" },
{ XFS.Path(@"c:\Project\Project.csproj"), "<Project Sdk=\"Microsoft.NET.Sdk\" />" },
{ XFS.Path(@"c:\Project\packages.config"), "" },
});
var mockDotnetUtilsService = new Mock<IDotnetUtilsService>();
Expand Down

0 comments on commit 0590e6f

Please sign in to comment.