Skip to content

Instantly share code, notes, and snippets.

View iknowcodesoup's full-sized avatar
🖖
⭐ ⭐ ⭐ ⭐ ⭐

Jeff Holcombe iknowcodesoup

🖖
⭐ ⭐ ⭐ ⭐ ⭐
View GitHub Profile
@iknowcodesoup
iknowcodesoup / MockHttpMessageHandler.cs
Created August 3, 2022 18:38
MockHttpMessageHandler
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace Namespace123
{
public class MockHttpMessageHandler : HttpMessageHandler
{
private readonly HttpResponseMessage? message;
@iknowcodesoup
iknowcodesoup / StringExtentions.cs
Last active October 11, 2019 13:05
Some common extensions used over the years in some revision or another
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
namespace Extensions
{
public static class StringExtensions
{
private static readonly Regex _keyRegex = new Regex("{([^{}:]+)(?::([^{}]+))?}", RegexOptions.Compiled);
@iknowcodesoup
iknowcodesoup / FeatureClassNameTests.cs
Last active August 6, 2020 18:09
This is a non-tested sample of how to use TheoryData to create a unit testing setup using stubs / mocks. Have been using it for years with much success. Not sure of the original article but this one is the first hit: https://andrewlock.net/creating-strongly-typed-xunit-theory-test-data-with-theorydata/
using System;
using Moq;
using Refit;
using Xunit;
namespace Some.Kind.Of.Space
{
[Collection("Feature Name")]
[Trait("Feature Aspect", "Classification")]
public class FeatureClassNameTests
@iknowcodesoup
iknowcodesoup / sample_subject.cs
Created November 10, 2018 18:56
Observable subject -
/* Use with caution! http://davesexton.com/blog/post/To-Use-Subject-Or-Not-To-Use-Subject.aspx */
public class SomeClass {
private readonly Subject<int> triggerableObservable =
new Subject<int>();
public IObservable<int> TriggeredObservable => triggerableObservable.AsObservable();
private IDisposable subscription;
public SomeClass()
@iknowcodesoup
iknowcodesoup / ObjectActivator.cs
Created October 12, 2018 02:04
dont-use-activator-createinstance-or-constructorinfo-invoke-use-compiled-lambda-expressions
namespace SView.Global
{
using System;
using System.Linq.Expressions;
using System.Reflection;
/// <summary>
/// https://vagifabilov.wordpress.com/2010/04/02/dont-use-activator-createinstance-or-constructorinfo-invoke-use-compiled-lambda-expressions/
/// </summary>
public class Activator