This file contains 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 TechTalk.SpecFlow; | |
using Xunit; | |
namespace Example.SpecFlowTests.Hooks; | |
[Binding] | |
public class SkipHook | |
{ | |
[BeforeScenario(tags: "skip")] | |
public static void BeforeScenario() |
This file contains 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 StreamReaderExtensions | |
{ | |
public static IEnumerable<string> ReadLines(this StreamReader reader) | |
{ | |
string? line; | |
while ((line = reader.ReadLine()) is not null) | |
{ | |
yield return line; | |
} | |
} |
This file contains 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 System; | |
/// <summary> | |
/// Convenient wrapper for an Action that must be called in spite of exceptions. | |
/// Use with a `using` statement. | |
/// <code> | |
/// using var _ = new ActionDisposable(action); | |
/// </code> | |
/// </summary> | |
public class ActionDisposable : IDisposable |
This file contains 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
function downloadBlob(blob: Blob, filename: string): void { | |
const downloadLink = document.createElement('a'); | |
document.body.appendChild(downloadLink); | |
downloadLink.style.setProperty('display', 'none'); | |
const objectUrl = URL.createObjectURL(blob); | |
downloadLink.href = objectUrl; | |
downloadLink.download = filename; | |
downloadLink.click(); | |
URL.revokeObjectURL(objectUrl); |
This file contains 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
function toPromise(dbRequest: IDBRequest<any>): Promise<any> { | |
return new Promise((resolve, reject) => { | |
dbRequest.onsuccess = () => resolve(dbRequest.result); | |
dbRequest.onerror = () => reject(); | |
}); | |
} |
This file contains 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 Moq; | |
using System; | |
using System.Net.Http; | |
namespace Example.Testing | |
{ | |
public static class HttpMocking | |
{ | |
public static void SetupHttpClient(this Mock<IHttpClientFactory> httpClientFactory, string response = "") | |
{ |
This file contains 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 System; | |
namespace Example | |
{ | |
public static class TypeExtensions | |
{ | |
/// <summary> | |
/// Returns a default value for a given Type at run-time. | |
/// </summary> | |
public static object GetDefaultValue(this Type type) |
This file contains 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 Microsoft.Extensions.DependencyInjection; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using Xunit.Sdk; | |
namespace Example.Testing | |
{ | |
/// <summary> |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- copy to ~/Library/XamarinStudio-5.0/Snippets/ as vmpc.template.xml --> | |
<CodeTemplates version="3.0"> | |
<CodeTemplate version="2.0"> | |
<Header> | |
<_Group>C#</_Group> | |
<Version /> | |
<MimeType>text/x-csharp</MimeType> | |
<Shortcut>vmpc</Shortcut> | |
<_Description>property changed</_Description> |
This file contains 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 System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using QuickGraph; | |
using QuickGraph.Algorithms; | |
using ServiceStack.OrmLite; | |
namespace Gists | |
{ | |
public static class CodeFirstDatabase |
NewerOlder