Skip to content

Instantly share code, notes, and snippets.

View jwChung's full-sized avatar

Jin-Wook Chung jwChung

View GitHub Profile
class Program
{
static void Main(string[] args)
{
var stopwatch = new Stopwatch();
stopwatch.Start();
RunParallelly().Wait();
stopwatch.Stop();
@jwChung
jwChung / UserStore.cs
Created May 15, 2017 17:25
UserStore
public class UserStore :
UserStore<User, Role, string, UserLogin, UserRole, UserClaim>
{
private bool disposed;
public UserStore(DbContext context)
: base(context)
{
}
type Result<'a> =
| Success of 'a
| Failure of string list
module Result =
let map f xResult =
match xResult with
| Success x ->
@jwChung
jwChung / payment.cs
Last active May 7, 2022 02:45
Payment Example
using System;
using System.Collections.Generic;
namespace ClassLibrary3
{
public class Program
{
public static void Main(string[] args)
{
var service = new PaymentService(
@jwChung
jwChung / factory-patterns.cs
Last active April 3, 2016 12:35
Factory Method vs Abstract Factory
using System;
namespace ClassLibrary3
{
public interface IProduct
{
}
public class Foo : IProduct
{
public interface IFactory<T>
{
T Create();
}
public class CacheFactory<T> : IFactory<T>
{
private T cached;
private readonly object syncLook = new object();
public interface IPageViewTracker
{
IDisposable Track(Page page);
}
public class NamedPageViewTracker : IPageViewTracker
{
public NamedPageViewTracker(
IPageViewTracker innerTacker, IPageViewNameProvider provider)
{
@jwChung
jwChung / FakeDbSet.cs
Last active August 29, 2015 14:09
FakeDbSet
namespace ArticleHarbor.DomainModel
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Linq.Expressions;
@jwChung
jwChung / Mocked.cs
Created September 7, 2014 15:16
Mocked.cs
namespace Jwc.Experiment.Xunit
{
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Moq;
public static class Mocked
{
@jwChung
jwChung / MockExtensions.cs
Created September 1, 2014 03:42
The Of extension method to confiture existing a mocked instance using LINQ query syntax.
namespace Jwc.MoqExtensions
{
using Moq;
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using Xunit;
public interface IFoo