Skip to content

Instantly share code, notes, and snippets.

View dfbaskin's full-sized avatar

Dave F. Baskin dfbaskin

View GitHub Profile
@saschwarz
saschwarz / commands.js
Last active August 31, 2022 07:16
Automated Azure AD login and session token capture to json file for reading by Cypress commands. Heavily inspired by https://gist.github.com/pieterdv/82773fbe036719479d76ab0a4985dc3b
const API = Cypress.env('API');
const headers = {
Authorization: '',
};
Cypress.Commands.add('loginUser', () => {
return cy.readFile('aad-tokens.json')
.then(creds => {
// set auth headers so test setup calls are authorized
@mhagrelius
mhagrelius / IAsyncEnumerable.cs
Created October 2, 2019 19:17
IAsyncEnumerable ADO.NET Example
public static async IAsyncEnumerable<IEnumerable<object?>> GetResults(this SqlConnection connection, string query, [EnumeratorCancellation] CancellationToken token)
{
if (string.IsNullOrWhiteSpace(query))
{
throw new ArgumentException(nameof(query));
}
var wasClosed = connection.State != ConnectionState.Open;
try
{
if (wasClosed)