This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<!-- Add the following SDK reference 👇 --> | |
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" /> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net8.0</TargetFramework> | |
<ImplicitUsings>enable</ImplicitUsings> | |
<Nullable>enable</Nullable> | |
<IsAspireHost>true</IsAspireHost> | |
<UserSecretsId>360e1e8e-629b-4b91-8be6-3587b33fa61d</UserSecretsId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void WhenIAddTwoRandomNumbersTheResultShouldNotDependOnParameterOrder_2() | |
{ | |
var config = Config.Default.WithMaxTest(200); | |
var addingTwoRandomNumbers = (int x, int y) => Add(x, y) == Add(y, x); | |
Prop.ForAll(new Func<int, int, bool>(addingTwoRandomNumbers)) | |
.Check(config); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Gen<Reservation> GenerateReservation => | |
from d in ArbMap.Default.GeneratorFor<DateTime>() | |
from e in ArbMap.Default.GeneratorFor<NonWhiteSpaceString>() | |
from n in ArbMap.Default.GeneratorFor<NonWhiteSpaceString>() | |
from q in ArbMap.Default.GeneratorFor<PositiveInt>() | |
select new Reservation | |
{ | |
Date = d, | |
Email = e.Item, | |
Name = n.Item, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FsCheck.Xunit; | |
using FsCheck; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
//Add this namespace to add the Throws method to the Prop | |
using FsCheck.FSharp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using FsCheck; | |
using FsCheck.Fluent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.MapScalarApiReference(options => { | |
options | |
.WithTitle("Example API"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Services.AddOpenApi(options => { | |
options.AddDocumentTransformer<AuthenticationSchemeTransformer>(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal sealed class AuthenticationSchemeTransformer(Microsoft.AspNetCore.Authentication.IAuthenticationSchemeProvider authenticationSchemeProvider) : IOpenApiDocumentTransformer | |
{ | |
public async Task TransformAsync(OpenApiDocument document, OpenApiDocumentTransformerContext context, CancellationToken cancellationToken) | |
{ | |
var authenticationSchemes = await authenticationSchemeProvider.GetAllSchemesAsync(); | |
if (authenticationSchemes.Any(authScheme => authScheme.Name == "API Key")) | |
{ | |
document.Components ??= new OpenApiComponents(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
builder.Services.AddAuthentication(options => | |
{ | |
options.DefaultAuthenticateScheme = "API Key"; | |
options.DefaultChallengeScheme = "API Key"; | |
}) | |
.AddScheme<IAMApiKeyAuthenticationOptions, IAMApiKeyAuthenticationHandler>("API Key", options); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-WinEvent -FilterHashtable @{ | |
'LogName' = 'Microsoft-Windows-TaskScheduler/Operational' | |
'ID' = 200, 201 | |
} | Group-Object ActivityID | ForEach-Object { | |
$start = $_.Group | | |
Where-Object { $_.Id -eq 200 } | | |
Select-Object -Expand TimeCreated -First 1 | |
$end = $_.Group | | |
Where-Object { $_.Id -eq 201 } | | |
Select-Object -Expand TimeCreated -First 1 |
NewerOlder