Skip to content

Instantly share code, notes, and snippets.

View davidwhitney's full-sized avatar
🍸
You're all wonderful. That's what's happening.

David Whitney davidwhitney

🍸
You're all wonderful. That's what's happening.
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace RubberDucky
{
@davidwhitney
davidwhitney / gist:9bdaea45a1ac2f71ee12
Created March 30, 2015 13:15
DEATH TO ALL FALSE COMMENTS
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
namespace rostest
{
[TestFixture]
public class Class1
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/ExcludedFiles/FileMasksToSkip/=_002A_002Emin_002Ejs/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Full Cleanup</s:String>
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=PropertyBody/@EntryIndexedValue">Default body (from options)</s:String>
<s:Boolean x:Key="/Default/Environment/ExternalSources/FirstTimeFormShown/
@davidwhitney
davidwhitney / AmazonWebDriverExample-Bad.cs
Created April 1, 2015 15:32
Horrible web driver code
[TestFixture]
public class AmazonWebDriverExample
{
private RemoteWebDriver _selenim;
[SetUp]
public void Setup()
{
_selenim = new PhantomJSDriver();
}
@davidwhitney
davidwhitney / PassengerExample.cs
Last active August 29, 2015 14:18
Passenger webdriver example
[TestFixture]
public class PassengerExample
{
private PassengerConfiguration _testConfig;
private PageObjectTestContext<AmazonHomepage> _ctx;
[SetUp]
public void Setup()
{
@davidwhitney
davidwhitney / RetryAndTests.cs
Created April 14, 2015 12:41
Retry example
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace ClassLibrary1
{
[TestFixture]
public class Class1
{
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
namespace triangle
{
public class Pascal
{
public static string GenerateNicely(int maxDepth)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NUnit.Framework;
namespace ClassLibrary1
@davidwhitney
davidwhitney / Container.cs
Created February 3, 2016 11:15
Kata example for IoC
public class Container
{
private readonly Dictionary<Type, Type> _simpleMappings = new Dictionary<Type, Type>();
public T Create<T>()
{
return (T) Create(typeof (T));
}
public object Create(Type t)

How stuff works – meta-programming in C# 101

We live in a world where our tools, frameworks and libraries are often built for us. Especially in .NET, we rely on ASP.NET MVC, DI Containers, Unit testing tools and IDEs and all of these things sell themselves on hiding complexity and being "hard problems".

In this session, I want to explain how all these big tools and frameworks aren't really that different, and are built using the same language and practices that you using in your user-land code every day.

We'll break down how all that stuff works - MVC, Test frameworks and containers - illustrating how it's all just meta-programming with reflection, and hopefully leave you with practical tips for implementing strong conventions, discovery, and implementing composition in your own code bases.