Skip to content

Instantly share code, notes, and snippets.

View robertwilczynski's full-sized avatar

Robert Wilczyński robertwilczynski

View GitHub Profile
@robertwilczynski
robertwilczynski / gist:5533492
Created May 7, 2013 15:25
Extremely ugly C# constructor tester to catch lack of guard clauses for null/empty/whitespace values passed to constructor arguments
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Xunit.Sdk;
namespace SaaSOvation.IssueTrack.Core.Tests
{
public class CtorTester
{
@robertwilczynski
robertwilczynski / DynamicModelBinder.cs
Created November 27, 2011 00:05
Some fun with asp.net mvc dynamic model binder
protected void Application_Start()
{
ModelBinders.Binders.DefaultBinder = new DynamicModelBinder(ModelBinders.Binders.DefaultBinder);
}
public class DynamicModel : DynamicObject
{
readonly NameValueCollection _attributes;
public DynamicModel(NameValueCollection attributes)
@robertwilczynski
robertwilczynski / get-assemblies-that-reference-unity.ps1
Created August 21, 2011 09:34
Powershell script to list all assemblies in the current dir that reference some other assembly (unity in this case).
Get-ChildItem -Filter *.dll .\ | ForEach-Object { foreach ($asm in [System.Reflection.Assembly]::LoadFrom($_.FullName).GetReferencedAssemblies()) { echo "$_.Name - $asm"} } | where { $_ -Match "unity" }
@robertwilczynski
robertwilczynski / PropertyEvaluation.cs
Created January 5, 2010 17:49
Evaluating possible null reference expressions
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Linq.Expressions;
using System.Diagnostics;
namespace CallChainMagic
{