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
# Check if the git command is available | |
if (-not (Get-Command git -ErrorAction SilentlyContinue)) { | |
Write-Host "Git is not installed or not available in the PATH." -ForegroundColor Red | |
exit | |
} | |
# Ensure we're in a git repository | |
$gitStatus = git rev-parse --is-inside-work-tree 2>&1 | |
if ($gitStatus -ne "true") { | |
Write-Host "This is not a git repository." -ForegroundColor Red |
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
public class Error(ErrorType ErrorType, string Description) | |
{ | |
public static Error Empty => new(ErrorType.Default, string.Empty); | |
public static Error ValidationError => new(ErrorType.ValidationError, "This is a validation error"); | |
public static Error DomainLogicError => new(ErrorType.Failure, "This is a domain logic error"); | |
} |
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
#r "nuget: dotenv.net, 3.0.0" | |
using dotenv.net; | |
using System.IO; | |
var currentDir = Directory.GetCurrentDirectory(); | |
var secretsFileLocation = Path.Combine(currentDir, "secrets.env"); | |
DotEnv.Load(options: new DotEnvOptions(envFilePaths: new[] { secretsFileLocation }, ignoreExceptions: false)); | |
var mySecret = System.Environment.GetEnvironmentVariable("mysecret"); |
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
public interface IA {} | |
public interface IB {} | |
public interface IC<in THandle> where THandle : IA{ } | |
public class ContentNotificationAsyncHandler : INotificationAsyncHandler<ContentPublishedNotification> | |
{ | |
private readonly ILogger<ContentNotificationAsyncHandler> _logger; |
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
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
// See the LICENSE file in the project root for more information. | |
using System.ComponentModel; | |
namespace System.Runtime.CompilerServices | |
{ | |
/// <summary> | |
/// Reserved to be used by the compiler for tracking metadata. |
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 class NamedPropertyWithValueSpecimenBuilder<TValue> : ISpecimenBuilder | |
{ | |
private readonly string _parameterName; | |
private readonly TValue _value; | |
public NamedPropertyWithValueSpecimenBuilder(string parameterName, TValue value) | |
{ | |
_parameterName = parameterName; | |
_value = value; | |
} |
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
public class NamedParameterWithValueSpecimenBuilder<TValue> : ISpecimenBuilder | |
{ | |
private readonly string _parameterName; | |
private readonly TValue _value; | |
public NamedParameterWithValueSpecimenBuilder(string parameterName, TValue value) | |
{ | |
_parameterName = parameterName; | |
_value = value; | |
} |
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
public sealed class AutoDataWithCustomizationAttribute : AutoDataAttribute | |
{ | |
public AutoDataWithCustomizationAttribute(params Type[] customizations) : base(() => new Fixture() | |
.Customize(new CompositeCustomization(customizations.Select(customization => (ICustomization)Activator.CreateInstance(customization))))) | |
{ | |
} | |
} |
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
public static class StringExtensions | |
{ | |
static readonly string[] serverAliases = | |
{ | |
"server", "host", "data source", "datasource", "address", | |
"addr", "network address" | |
}; | |
static readonly string[] databaseAliases = {"database", "initial catalog"}; | |
static readonly string[] usernameAliases = {"user id", "uid", "username", "user name", "user"}; |
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
<# | |
.Synopsis | |
Creates a tag based on the $(Build.BuildNumber) and the $(Build.SourceBranch) | |
.Description | |
This purpose of this script is to create -beta tag if the source branch is different from master branch | |
We can use this version to tag nuget packages, and docker images with a -beta, so we can distinquish | |
between live and beta builds | |
.Example | |
1. Include this script as the first step in a build pipeline | |
2. Make sure that you provide a reference name under 'Output variables' in the powershell task |
NewerOlder