Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ TestResult.xml

# VERIFY
*.received.*
**/*.received/

# Build Results of an ATL Project
[Dd]ebugPS/
Expand Down
6 changes: 6 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,11 @@
<!-- Compatibility with VS 17.8/.NET SDK 8.0.1xx -->
<MicrosoftCodeAnalysisVersion>4.8.0</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>3.3.4</MicrosoftCodeAnalysisAnalyzersVersion>

<!--
xUnit version is configured by the Arcade SDK.
https://github.com/dotnet/arcade/blob/f5a7c5d5c56197b09715dece7541ca06beb94eb0/src/Microsoft.DotNet.Arcade.Sdk/tools/XUnit/XUnit.targets#L9
-->
<XUnitVersion>2.9.3</XUnitVersion>
</PropertyGroup>
</Project>
7 changes: 5 additions & 2 deletions eng/build.proj
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<Project Sdk="Microsoft.Build.Traversal">
<ItemGroup>
<_SnapshotsToExclude Include="$(MSBuildThisFileDirectory)..\test\**\Snapshots\**\*.*proj" />

<!-- We recursively add all of the projects inside the src directory, except for the exclusions above -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\**\*.csproj" Exclude="@(_ProjectsToExclude)" />
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\**\*.csproj" />
<!-- We recursively add all of the test projects -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\test\**\*.csproj" />
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\bench\**\*.csproj" />
<!-- Additionally, include the transport project that is not defined as a csproj -->
<_ProjectsToBuild Include="$(MSBuildThisFileDirectory)..\src\Packages\Microsoft.Internal.Extensions.DotNetApiDocs.Transport\Microsoft.Internal.Extensions.DotNetApiDocs.Transport.proj" />

<!-- Add all the projects we want to build as project references, so the traversal SDK can build them -->
<ProjectReference Include="@(_ProjectsToBuild)" />
<ProjectReference Include="@(_ProjectsToBuild)" Exclude="@(_ProjectsToExclude);@(_SnapshotsToExclude)" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion eng/packages/General.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="System.Runtime.Caching" Version="$(SystemRuntimeCachingVersion)" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
<PackageVersion Include="YamlDotNet" Version="12.3.1" />
Expand Down
8 changes: 5 additions & 3 deletions eng/packages/TestOnly.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@
<PackageVersion Include="Azure.Identity" Version="1.13.2" />
<PackageVersion Include="autofixture" Version="4.17.0" />
<PackageVersion Include="BenchmarkDotNet" Version="0.13.5" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.65.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.2.3" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageVersion Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="3.1.3" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.0" />
<PackageVersion Include="Microsoft.ML.Tokenizers.Data.O200kBase" Version="$(MicrosoftMLTokenizersVersion)" />
<PackageVersion Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" Version="9.0.201" />
<PackageVersion Include="Microsoft.TemplateEngine.TestHelper" Version="9.0.200-rtm.25066.4" />
<PackageVersion Include="Moq.AutoMock" Version="3.1.0" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.9.0" />
<PackageVersion Include="Polly.Testing" Version="8.4.2" />
<PackageVersion Include="StrongNamer" Version="0.2.5" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageVersion Include="System.Numerics.Tensors" Version="$(SystemNumericsTensorsVersion)" />
<PackageVersion Include="Verify.Xunit" Version="20.4.0" />
<PackageVersion Include="Verify.Xunit" Version="28.15.0" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit.extensibility.execution" Version="2.4.2" />
<PackageVersion Include="xunit.extensibility.execution" Version="$(XUnitVersion)" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion scripts/Slngen.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ param (
[Parameter(Mandatory = $false, HelpMessage="Enables use of folders.")]
[switch]$Folders = $false,
[Parameter(Mandatory = $false, HelpMessage="Path to exclude from search for project files. Must be repo root folder based.")]
[string[]]$ExcludePaths = @('src\Tools\MutationTesting\samples\', 'src\Templates\templates'),
[string[]]$ExcludePaths = @('src\Tools\MutationTesting\samples\', 'src\Templates\templates', 'test\**\Snapshots'),
[Parameter(Mandatory = $false, HelpMessage="Don't launch Visual Studio.")]
[switch]$NoLaunch = $false,
[Parameter(Mandatory = $false, HelpMessage="Minimizes console output.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

namespace Microsoft.Gen.Logging.Test;

[UsesVerify]
public partial class ParserTests
{
private const int TotalSensitiveCases = 21;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test;

[UsesVerify]
public sealed class LinuxNetworkUtilizationParserTests
{
private const string VerifiedDataDirectory = "Verified";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test;

[OSSkipCondition(OperatingSystems.Windows | OperatingSystems.MacOSX, SkipReason = "Linux specific tests")]
[UsesVerify]
public sealed class LinuxUtilizationParserCgroupV2Tests
{
private const string VerifiedDataDirectory = "Verified";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Test;

[OSSkipCondition(OperatingSystems.Windows | OperatingSystems.MacOSX, SkipReason = "Linux specific tests")]
[UsesVerify]
public sealed class LinuxUtilizationProviderTests
{
private const string VerifiedDataDirectory = "Verified";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
Type: InvalidOperationException,
Message: Could not split contents. We expected every line to contain more than 4 elements, but it has only 2 elements.,
StackTrace:
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.UpdateTcpStateInfo(ReadOnlySpan`1 buffer, TcpStateInfo tcpStateInfo)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.GetTcpStateInfo(FileInfo file)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.GetTcpIPv4StateInfo()
at Xunit.Record.Exception(Func`1 testCode)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
Type: InvalidOperationException,
Message: Could not split contents. We expected every line to contain more than 4 elements, but it has only 2 elements.,
StackTrace:
at Microsoft.Shared.Diagnostics.Throw.InvalidOperationException(String message)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.UpdateTcpStateInfo(ReadOnlySpan`1 buffer, TcpStateInfo tcpStateInfo)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.GetTcpStateInfo(FileInfo file)
at Microsoft.Extensions.Diagnostics.ResourceMonitoring.Linux.Network.LinuxNetworkUtilizationParser.GetTcpIPv4StateInfo()
at Xunit.Record.Exception(Func`1 testCode)
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test;
/// <summary>
/// Tests for the DataTracker class.
/// </summary>
[UsesVerify]
public sealed class ResourceMonitoringServiceTests
{
private const string ProviderUnableToGatherData = "Unable to gather utilization statistics.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Windows.Test;

[UsesVerify]
public sealed class WindowsContainerSnapshotProviderTests
{
private const string VerifiedDataDirectory = "Verified";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
namespace Microsoft.Extensions.Diagnostics.ResourceMonitoring.Windows.Test;

[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX, SkipReason = "Windows specific.")]
[UsesVerify]
public sealed class WindowsSnapshotProviderTests
{
private const string VerifiedDataDirectory = "Verified";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.IO;
using System.Threading.Tasks;
using EmptyFiles;
using Microsoft.Extensions.AI.Templates.IntegrationTests;
using Microsoft.Extensions.AI.Templates.Tests;
using Microsoft.Extensions.Logging;
using Microsoft.TemplateEngine.Authoring.TemplateVerifier;
using Microsoft.TemplateEngine.TestHelper;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Extensions.AI.Templates.InegrationTests;

public class AichatwebTemplatesTests : TestBase
{
private readonly ILogger _log;

public AichatwebTemplatesTests(ITestOutputHelper log)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
_log = new XunitLoggerProvider(log).CreateLogger("TestRun");
#pragma warning restore CA2000 // Dispose objects before losing scope
}

[Fact]
public async Task BasicTest()
{
string workingDir = TestUtils.CreateTemporaryFolder();
string templateShortName = "aichatweb";

// Get the template location
string templateLocation = Path.Combine(TemplateFeedLocation, "Microsoft.Extensions.AI.Templates", "src", "ChatWithCustomData");

// Treat *.in files as text, see https://github.com/VerifyTests/EmptyFiles#istext
FileExtensions.AddTextExtension(".in");

TemplateVerifierOptions options = new TemplateVerifierOptions(templateName: templateShortName)
{
TemplatePath = templateLocation,
SnapshotsDirectory = "Snapshots",
OutputDirectory = workingDir,
DoNotPrependCallerMethodNameToScenarioName = true,
ScenarioName = "Basic",
}
.WithCustomScrubbers(
ScrubbersDefinition.Empty.AddScrubber((path, content) =>
{
string filePath = path.UnixifyDirSeparators();
if (filePath.EndsWith("aichatweb/ChatWithCustomData.Web/ChatWithCustomData.Web.csproj") ||
filePath.EndsWith("aichatweb/aichatweb.csproj") ||
filePath.EndsWith("aichatweb/aichatweb.csproj.in"))
{
content.ScrubByRegex("<UserSecretsId>(.*)<\\/UserSecretsId>", "<UserSecretsId>secret</UserSecretsId>");
}

if (filePath.EndsWith("aichatweb/Properties/launchSettings.json"))
{
content.ScrubByRegex("(http(s?):\\/\\/localhost)\\:(\\d*)", "$1:9999");
}
}));

VerificationEngine engine = new VerificationEngine(_log);
await engine.Execute(options);

#pragma warning disable CA1031 // Do not catch general exception types
try
{
Directory.Delete(workingDir, recursive: true);
}
catch
{
/* don't care */
}
#pragma warning restore CA1031 // Do not catch general exception types
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Unit tests for Microsoft.Extensions.AI.Templates.</Description>
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);CA1063;CA1861;CA2201;VSTHRD003;S104;S125;S2699</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" />
<PackageReference Include="Microsoft.TemplateEngine.TestHelper" />
</ItemGroup>

<ItemGroup>
<Compile Remove="Snapshots\**\*.*" />
<None Include="Snapshots\**\*.*" />
</ItemGroup>

</Project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="@Assets["app.css"]" />
<link rel="stylesheet" href="@Assets["aichatweb.styles.css"]" />
<ImportMap />
<HeadOutlet @rendermode="@renderMode" />
</head>

<body>
<Routes @rendermode="@renderMode" />
<script src="@Assets["app.js"]" type="module"></script>
<script src="@Assets["_framework/blazor.web.js"]"></script>
</body>

</html>

@code {
private readonly IComponentRenderMode renderMode = new InteractiveServerRenderMode(prerender: false);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* Used under CC0 license */

.lds-ellipsis {
color: #666;
animation: fade-in 1s;
}

@keyframes fade-in {
0% {
opacity: 0;
}

100% {
opacity: 1;
}
}

.lds-ellipsis,
.lds-ellipsis div {
box-sizing: border-box;
}

.lds-ellipsis {
margin: auto;
display: block;
position: relative;
width: 80px;
height: 80px;
}

.lds-ellipsis div {
position: absolute;
top: 33.33333px;
width: 10px;
height: 10px;
border-radius: 50%;
background: currentColor;
animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.lds-ellipsis div:nth-child(1) {
left: 8px;
animation: lds-ellipsis1 0.6s infinite;
}

.lds-ellipsis div:nth-child(2) {
left: 8px;
animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(3) {
left: 32px;
animation: lds-ellipsis2 0.6s infinite;
}

.lds-ellipsis div:nth-child(4) {
left: 56px;
animation: lds-ellipsis3 0.6s infinite;
}

@keyframes lds-ellipsis1 {
0% {
transform: scale(0);
}

100% {
transform: scale(1);
}
}

@keyframes lds-ellipsis3 {
0% {
transform: scale(1);
}

100% {
transform: scale(0);
}
}

@keyframes lds-ellipsis2 {
0% {
transform: translate(0, 0);
}

100% {
transform: translate(24px, 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@inherits LayoutComponentBase

@Body

<div id="blazor-error-ui" data-nosnippet>
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
<span class="dismiss">🗙</span>
</div>
Loading
Loading