测试
This commit is contained in:
26
HardwarePerformance.Tests/HardwarePerformance.Tests.csproj
Normal file
26
HardwarePerformance.Tests/HardwarePerformance.Tests.csproj
Normal file
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="Moq" Version="4.20.70" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MinimalAPI\MinimalAPI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
97
HardwarePerformance.Tests/Services/CategoryServiceTests.cs
Normal file
97
HardwarePerformance.Tests/Services/CategoryServiceTests.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using AutoMapper;
|
||||
using HardwarePerformance.Models;
|
||||
using HardwarePerformance.Models.DTOs;
|
||||
using HardwarePerformance.Services;
|
||||
using Moq;
|
||||
|
||||
namespace HardwarePerformance.Tests.Services
|
||||
{
|
||||
public class CategoryServiceTests
|
||||
{
|
||||
private readonly Mock<ICategoryRepository> _mockCategoryRepository;
|
||||
private readonly Mock<IMapper> _mockMapper;
|
||||
private readonly CategoryService _categoryService;
|
||||
|
||||
public CategoryServiceTests()
|
||||
{
|
||||
_mockCategoryRepository = new Mock<ICategoryRepository>();
|
||||
_mockMapper = new Mock<IMapper>();
|
||||
_categoryService = new CategoryService(_mockCategoryRepository.Object, _mockMapper.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetAllCategoriesAsync_ReturnsAllCategories()
|
||||
{
|
||||
// Arrange
|
||||
var categories = new List<Category>
|
||||
{
|
||||
new Category { Id = 1, Name = "手机CPU", Description = "手机处理器" },
|
||||
new Category { Id = 2, Name = "电脑CPU", Description = "电脑处理器" }
|
||||
};
|
||||
|
||||
var categoryDtos = new List<CategoryDto>
|
||||
{
|
||||
new CategoryDto { Id = 1, Name = "手机CPU", Description = "手机处理器" },
|
||||
new CategoryDto { Id = 2, Name = "电脑CPU", Description = "电脑处理器" }
|
||||
};
|
||||
|
||||
_mockCategoryRepository.Setup(repo => repo.GetAllAsync())
|
||||
.ReturnsAsync(categories);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<IEnumerable<CategoryDto>>(categories))
|
||||
.Returns(categoryDtos);
|
||||
|
||||
// Act
|
||||
var result = await _categoryService.GetAllCategoriesAsync();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(2, result.Count());
|
||||
_mockCategoryRepository.Verify(repo => repo.GetAllAsync(), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<IEnumerable<CategoryDto>>(categories), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetCategoryByIdAsync_ExistingCategory_ReturnsCategoryDto()
|
||||
{
|
||||
// Arrange
|
||||
var categoryId = 1;
|
||||
var category = new Category { Id = categoryId, Name = "手机CPU", Description = "手机处理器" };
|
||||
var categoryDto = new CategoryDto { Id = categoryId, Name = "手机CPU", Description = "手机处理器" };
|
||||
|
||||
_mockCategoryRepository.Setup(repo => repo.GetByIdAsync(categoryId))
|
||||
.ReturnsAsync(category);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<CategoryDto>(category))
|
||||
.Returns(categoryDto);
|
||||
|
||||
// Act
|
||||
var result = await _categoryService.GetCategoryByIdAsync(categoryId);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(categoryId, result.Id);
|
||||
Assert.Equal("手机CPU", result.Name);
|
||||
_mockCategoryRepository.Verify(repo => repo.GetByIdAsync(categoryId), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<CategoryDto>(category), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetCategoryByIdAsync_NonExistingCategory_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var categoryId = 999;
|
||||
|
||||
_mockCategoryRepository.Setup(repo => repo.GetByIdAsync(categoryId))
|
||||
.ReturnsAsync((Category?)null);
|
||||
|
||||
// Act
|
||||
var result = await _categoryService.GetCategoryByIdAsync(categoryId);
|
||||
|
||||
// Assert
|
||||
Assert.Null(result);
|
||||
_mockCategoryRepository.Verify(repo => repo.GetByIdAsync(categoryId), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<CategoryDto>(It.IsAny<Category>()), Times.Never);
|
||||
}
|
||||
}
|
||||
}
|
||||
173
HardwarePerformance.Tests/Services/ComparisonServiceTests.cs
Normal file
173
HardwarePerformance.Tests/Services/ComparisonServiceTests.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using AutoMapper;
|
||||
using HardwarePerformance.Models;
|
||||
using HardwarePerformance.Models.DTOs;
|
||||
using HardwarePerformance.Services;
|
||||
using Moq;
|
||||
|
||||
namespace HardwarePerformance.Tests.Services
|
||||
{
|
||||
public class ComparisonServiceTests
|
||||
{
|
||||
private readonly Mock<IProductRepository> _mockProductRepository;
|
||||
private readonly Mock<IMapper> _mockMapper;
|
||||
private readonly ComparisonService _comparisonService;
|
||||
|
||||
public ComparisonServiceTests()
|
||||
{
|
||||
_mockProductRepository = new Mock<IProductRepository>();
|
||||
_mockMapper = new Mock<IMapper>();
|
||||
_comparisonService = new ComparisonService(_mockProductRepository.Object, _mockMapper.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CompareProductsAsync_ValidProductIds_ReturnsComparisonData()
|
||||
{
|
||||
// Arrange
|
||||
var productIds = new List<int> { 1, 2 };
|
||||
|
||||
var products = new List<Product>
|
||||
{
|
||||
new Product
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Intel Core i9",
|
||||
Manufacturer = "Intel",
|
||||
CategoryId = 1,
|
||||
CurrentRank = 1,
|
||||
ReleaseDate = DateTime.Now.AddMonths(-6),
|
||||
Price = 500,
|
||||
PerformanceScore = 4000,
|
||||
PerformanceScores = new List<PerformanceScore>
|
||||
{
|
||||
new PerformanceScore { Id = 1, ProductId = 1, TestType = "Single-Core", Score = 1500 },
|
||||
new PerformanceScore { Id = 2, ProductId = 1, TestType = "Multi-Core", Score = 8000 }
|
||||
},
|
||||
Specifications = new List<Specification>
|
||||
{
|
||||
new Specification { Id = 1, ProductId = 1, Name = "Cores", Value = "8" },
|
||||
new Specification { Id = 2, ProductId = 1, Name = "Threads", Value = "16" }
|
||||
}
|
||||
},
|
||||
new Product
|
||||
{
|
||||
Id = 2,
|
||||
Name = "AMD Ryzen 9",
|
||||
Manufacturer = "AMD",
|
||||
CategoryId = 1,
|
||||
CurrentRank = 2,
|
||||
ReleaseDate = DateTime.Now.AddMonths(-4),
|
||||
Price = 450,
|
||||
PerformanceScore = 3800,
|
||||
PerformanceScores = new List<PerformanceScore>
|
||||
{
|
||||
new PerformanceScore { Id = 3, ProductId = 2, TestType = "Single-Core", Score = 1400 },
|
||||
new PerformanceScore { Id = 4, ProductId = 2, TestType = "Multi-Core", Score = 7500 }
|
||||
},
|
||||
Specifications = new List<Specification>
|
||||
{
|
||||
new Specification { Id = 3, ProductId = 2, Name = "Cores", Value = "8" },
|
||||
new Specification { Id = 4, ProductId = 2, Name = "Threads", Value = "16" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var productDtos = new List<ProductDto>
|
||||
{
|
||||
new ProductDto
|
||||
{
|
||||
Id = 1,
|
||||
Name = "Intel Core i9",
|
||||
Manufacturer = "Intel",
|
||||
CategoryId = 1,
|
||||
CurrentRank = 1,
|
||||
ReleaseDate = DateTime.Now.AddMonths(-6),
|
||||
Price = 500,
|
||||
PerformanceScore = 4000,
|
||||
PerformanceScores = new List<PerformanceScore>
|
||||
{
|
||||
new PerformanceScore { Id = 1, ProductId = 1, TestType = "Single-Core", Score = 1500 },
|
||||
new PerformanceScore { Id = 2, ProductId = 1, TestType = "Multi-Core", Score = 8000 }
|
||||
},
|
||||
Specifications = new List<Specification>
|
||||
{
|
||||
new Specification { Id = 1, ProductId = 1, Name = "Cores", Value = "8" },
|
||||
new Specification { Id = 2, ProductId = 1, Name = "Threads", Value = "16" }
|
||||
}
|
||||
},
|
||||
new ProductDto
|
||||
{
|
||||
Id = 2,
|
||||
Name = "AMD Ryzen 9",
|
||||
Manufacturer = "AMD",
|
||||
CategoryId = 1,
|
||||
CurrentRank = 2,
|
||||
ReleaseDate = DateTime.Now.AddMonths(-4),
|
||||
Price = 450,
|
||||
PerformanceScore = 3800,
|
||||
PerformanceScores = new List<PerformanceScore>
|
||||
{
|
||||
new PerformanceScore { Id = 3, ProductId = 2, TestType = "Single-Core", Score = 1400 },
|
||||
new PerformanceScore { Id = 4, ProductId = 2, TestType = "Multi-Core", Score = 7500 }
|
||||
},
|
||||
Specifications = new List<Specification>
|
||||
{
|
||||
new Specification { Id = 3, ProductId = 2, Name = "Cores", Value = "8" },
|
||||
new Specification { Id = 4, ProductId = 2, Name = "Threads", Value = "16" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.GetByIdsAsync(productIds))
|
||||
.ReturnsAsync(products);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<List<ProductDto>>(products))
|
||||
.Returns(productDtos);
|
||||
|
||||
// Act
|
||||
var result = await _comparisonService.CompareProductsAsync(productIds);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(2, result.Products.Count);
|
||||
Assert.NotNull(result.ComparisonMatrix);
|
||||
_mockProductRepository.Verify(repo => repo.GetByIdsAsync(productIds), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<List<ProductDto>>(products), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CompareProductsAsync_EmptyProductIds_ThrowsArgumentException()
|
||||
{
|
||||
// Arrange
|
||||
var productIds = new List<int>();
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<ArgumentException>(async () =>
|
||||
await _comparisonService.CompareProductsAsync(productIds));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CompareProductsAsync_TooManyProductIds_ThrowsArgumentException()
|
||||
{
|
||||
// Arrange
|
||||
var productIds = new List<int> { 1, 2, 3, 4, 5 };
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<ArgumentException>(async () =>
|
||||
await _comparisonService.CompareProductsAsync(productIds));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CompareProductsAsync_NonExistingProductIds_ThrowsKeyNotFoundException()
|
||||
{
|
||||
// Arrange
|
||||
var productIds = new List<int> { 1, 2 };
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.GetByIdsAsync(productIds))
|
||||
.ReturnsAsync(new List<Product>());
|
||||
|
||||
// Act & Assert
|
||||
await Assert.ThrowsAsync<KeyNotFoundException>(async () =>
|
||||
await _comparisonService.CompareProductsAsync(productIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
184
HardwarePerformance.Tests/Services/ProductServiceTests.cs
Normal file
184
HardwarePerformance.Tests/Services/ProductServiceTests.cs
Normal file
@@ -0,0 +1,184 @@
|
||||
using AutoMapper;
|
||||
using HardwarePerformance.Models;
|
||||
using HardwarePerformance.Models.DTOs;
|
||||
using HardwarePerformance.Services;
|
||||
using Moq;
|
||||
|
||||
namespace HardwarePerformance.Tests.Services
|
||||
{
|
||||
public class ProductServiceTests
|
||||
{
|
||||
private readonly Mock<IProductRepository> _mockProductRepository;
|
||||
private readonly Mock<IMapper> _mockMapper;
|
||||
private readonly ProductService _productService;
|
||||
|
||||
public ProductServiceTests()
|
||||
{
|
||||
_mockProductRepository = new Mock<IProductRepository>();
|
||||
_mockMapper = new Mock<IMapper>();
|
||||
_productService = new ProductService(_mockProductRepository.Object, _mockMapper.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetProductsByCategoryAsync_ReturnsPagedProducts()
|
||||
{
|
||||
// Arrange
|
||||
var categoryId = 1;
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
var sortBy = "Name";
|
||||
var sortOrder = "asc";
|
||||
|
||||
var products = new List<Product>
|
||||
{
|
||||
new Product { Id = 1, Name = "Intel Core i9", CategoryId = categoryId },
|
||||
new Product { Id = 2, Name = "AMD Ryzen 9", CategoryId = categoryId }
|
||||
};
|
||||
|
||||
var productDtos = new List<ProductListDto>
|
||||
{
|
||||
new ProductListDto { Id = 1, Name = "Intel Core i9" },
|
||||
new ProductListDto { Id = 2, Name = "AMD Ryzen 9" }
|
||||
};
|
||||
|
||||
var pagedResult = new PagedResultDto<ProductListDto>
|
||||
{
|
||||
Items = productDtos,
|
||||
TotalCount = 2,
|
||||
Page = page,
|
||||
PageSize = pageSize
|
||||
};
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.GetByCategoryAsync(categoryId, page, pageSize, sortBy, sortOrder))
|
||||
.ReturnsAsync(products);
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.CountAsync(categoryId))
|
||||
.ReturnsAsync(2);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<IEnumerable<ProductListDto>>(products))
|
||||
.Returns(productDtos);
|
||||
|
||||
// Act
|
||||
var result = await _productService.GetProductsByCategoryAsync(categoryId, page, pageSize, sortBy, sortOrder);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(2, result.TotalCount);
|
||||
Assert.Equal(2, result.Items.Count());
|
||||
_mockProductRepository.Verify(repo => repo.GetByCategoryAsync(categoryId, page, pageSize, sortBy, sortOrder), Times.Once);
|
||||
_mockProductRepository.Verify(repo => repo.CountAsync(categoryId), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<IEnumerable<ProductListDto>>(products), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetProductByIdAsync_ExistingProduct_ReturnsProductDto()
|
||||
{
|
||||
// Arrange
|
||||
var productId = 1;
|
||||
var product = new Product
|
||||
{
|
||||
Id = productId,
|
||||
Name = "Intel Core i9",
|
||||
CategoryId = 1,
|
||||
PerformanceScores = new List<PerformanceScore>(),
|
||||
Specifications = new List<Specification>()
|
||||
};
|
||||
|
||||
var productDto = new ProductDto
|
||||
{
|
||||
Id = productId,
|
||||
Name = "Intel Core i9",
|
||||
CategoryId = 1,
|
||||
PerformanceScores = new List<PerformanceScore>(),
|
||||
Specifications = new List<Specification>()
|
||||
};
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.GetByIdAsync(productId))
|
||||
.ReturnsAsync(product);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<ProductDto>(product))
|
||||
.Returns(productDto);
|
||||
|
||||
// Act
|
||||
var result = await _productService.GetProductByIdAsync(productId);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(productId, result.Id);
|
||||
Assert.Equal("Intel Core i9", result.Name);
|
||||
_mockProductRepository.Verify(repo => repo.GetByIdAsync(productId), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<ProductDto>(product), Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetProductByIdAsync_NonExistingProduct_ReturnsNull()
|
||||
{
|
||||
// Arrange
|
||||
var productId = 999;
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.GetByIdAsync(productId))
|
||||
.ReturnsAsync((Product?)null);
|
||||
|
||||
// Act
|
||||
var result = await _productService.GetProductByIdAsync(productId);
|
||||
|
||||
// Assert
|
||||
Assert.Null(result);
|
||||
_mockProductRepository.Verify(repo => repo.GetByIdAsync(productId), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<ProductDto>(It.IsAny<Product>()), Times.Never);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SearchProductsAsync_ReturnsPagedSearchResults()
|
||||
{
|
||||
// Arrange
|
||||
var query = "Intel";
|
||||
var categoryId = 1;
|
||||
var manufacturer = "Intel";
|
||||
var minScore = 1000;
|
||||
var maxScore = 5000;
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
|
||||
var products = new List<Product>
|
||||
{
|
||||
new Product { Id = 1, Name = "Intel Core i9", Manufacturer = "Intel", CategoryId = categoryId, PerformanceScore = 4000 },
|
||||
new Product { Id = 2, Name = "Intel Core i7", Manufacturer = "Intel", CategoryId = categoryId, PerformanceScore = 3000 }
|
||||
};
|
||||
|
||||
var productDtos = new List<ProductListDto>
|
||||
{
|
||||
new ProductListDto { Id = 1, Name = "Intel Core i9" },
|
||||
new ProductListDto { Id = 2, Name = "Intel Core i7" }
|
||||
};
|
||||
|
||||
var pagedResult = new PagedResultDto<ProductListDto>
|
||||
{
|
||||
Items = productDtos,
|
||||
TotalCount = 2,
|
||||
Page = page,
|
||||
PageSize = pageSize
|
||||
};
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.SearchAsync(query, categoryId, manufacturer, minScore, maxScore, page, pageSize))
|
||||
.ReturnsAsync(products);
|
||||
|
||||
_mockProductRepository.Setup(repo => repo.CountSearchResultsAsync(query, categoryId, manufacturer, minScore, maxScore))
|
||||
.ReturnsAsync(2);
|
||||
|
||||
_mockMapper.Setup(m => m.Map<IEnumerable<ProductListDto>>(products))
|
||||
.Returns(productDtos);
|
||||
|
||||
// Act
|
||||
var result = await _productService.SearchProductsAsync(query, categoryId, manufacturer, minScore, maxScore, page, pageSize);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(2, result.TotalCount);
|
||||
Assert.Equal(2, result.Items.Count());
|
||||
_mockProductRepository.Verify(repo => repo.SearchAsync(query, categoryId, manufacturer, minScore, maxScore, page, pageSize), Times.Once);
|
||||
_mockProductRepository.Verify(repo => repo.CountSearchResultsAsync(query, categoryId, manufacturer, minScore, maxScore), Times.Once);
|
||||
_mockMapper.Verify(m => m.Map<IEnumerable<ProductListDto>>(products), Times.Once);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
HardwarePerformance.Tests/UnitTest1.cs
Normal file
10
HardwarePerformance.Tests/UnitTest1.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace HardwarePerformance.Tests;
|
||||
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"projectName": "HardwarePerformance.Tests",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"packagesPath": "C:\\Users\\代\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\代\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {},
|
||||
"https://nuget.cdn.azure.cn/v3/index.json": {},
|
||||
"https://packages.chinacloudapi.cn/v3/index.json": {},
|
||||
"https://packages.microsoft.com/dotnet": {},
|
||||
"https://www.nuget.org/api/v2/": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"dependencies": {
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"target": "Package",
|
||||
"version": "[17.12.0, )"
|
||||
},
|
||||
"coverlet.collector": {
|
||||
"target": "Package",
|
||||
"version": "[6.0.2, )"
|
||||
},
|
||||
"xunit": {
|
||||
"target": "Package",
|
||||
"version": "[2.9.2, )"
|
||||
},
|
||||
"xunit.runner.visualstudio": {
|
||||
"target": "Package",
|
||||
"version": "[2.8.2, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\代\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\代\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
126
HardwarePerformance.Tests/obj/project.assets.json
Normal file
126
HardwarePerformance.Tests/obj/project.assets.json
Normal file
@@ -0,0 +1,126 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": [
|
||||
"Microsoft.NET.Test.Sdk >= 17.12.0",
|
||||
"coverlet.collector >= 6.0.2",
|
||||
"xunit >= 2.9.2",
|
||||
"xunit.runner.visualstudio >= 2.8.2"
|
||||
]
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\代\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"projectName": "HardwarePerformance.Tests",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"packagesPath": "C:\\Users\\代\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\代\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"https://api.nuget.org/v3/index.json": {},
|
||||
"https://nuget.cdn.azure.cn/v3/index.json": {},
|
||||
"https://packages.chinacloudapi.cn/v3/index.json": {},
|
||||
"https://packages.microsoft.com/dotnet": {},
|
||||
"https://www.nuget.org/api/v2/": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.300"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"dependencies": {
|
||||
"Microsoft.NET.Test.Sdk": {
|
||||
"target": "Package",
|
||||
"version": "[17.12.0, )"
|
||||
},
|
||||
"coverlet.collector": {
|
||||
"target": "Package",
|
||||
"version": "[6.0.2, )"
|
||||
},
|
||||
"xunit": {
|
||||
"target": "Package",
|
||||
"version": "[2.9.2, )"
|
||||
},
|
||||
"xunit.runner.visualstudio": {
|
||||
"target": "Package",
|
||||
"version": "[2.8.2, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"logs": [
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='coverlet.collector'&semVerLevel=2.0.0”检索有关“coverlet.collector”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"libraryId": "coverlet.collector"
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='xunit'&semVerLevel=2.0.0”检索有关“xunit”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"libraryId": "xunit"
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0”检索有关“Microsoft.NET.Test.Sdk”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"libraryId": "Microsoft.NET.Test.Sdk"
|
||||
}
|
||||
]
|
||||
}
|
||||
36
HardwarePerformance.Tests/obj/project.nuget.cache
Normal file
36
HardwarePerformance.Tests/obj/project.nuget.cache
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "HWf5d7t+LFg=",
|
||||
"success": false,
|
||||
"projectFilePath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": [
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='coverlet.collector'&semVerLevel=2.0.0”检索有关“coverlet.collector”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"filePath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"libraryId": "coverlet.collector",
|
||||
"targetGraphs": []
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='xunit'&semVerLevel=2.0.0”检索有关“xunit”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"filePath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"libraryId": "xunit",
|
||||
"targetGraphs": []
|
||||
},
|
||||
{
|
||||
"code": "NU1301",
|
||||
"level": "Error",
|
||||
"message": "未能从远程源“https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.NET.Test.Sdk'&semVerLevel=2.0.0”检索有关“Microsoft.NET.Test.Sdk”的信息。\r\n 不知道这样的主机。 (null:80)\r\n 不知道这样的主机。",
|
||||
"projectPath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"filePath": "C:\\work\\电脑硬件-01\\HardwarePerformance.Tests\\HardwarePerformance.Tests.csproj",
|
||||
"libraryId": "Microsoft.NET.Test.Sdk",
|
||||
"targetGraphs": []
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user