Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tallseth on github.
  • I am sethmccarthy (https://keybase.io/sethmccarthy) on keybase.
  • I have a public key ASAJa6K8j1PB4QAREEzIlU-io81ldsCF0L59XDXcfeg8Ggo

To claim this, I am signing this object:

@tallseth
tallseth / ProxyTest.cs
Last active October 12, 2015 14:17
Simplify testing of proxy/decorator with generics in c#
public class ProxyTest
{
public static void AssertProxyDelegation<T,U>(T proxy, Mock<T> proxiedMock, Expression<Func<T,U>> func, U retVal) where T : class
{
proxiedMock.Setup(func).Returns(retVal);
Assert.That(func.Compile().Invoke(proxy), Is.SameAs(retVal));
}
public static void AssertProxyDelegation<T>(T delegator, Mock<T> delegatedTo, Expression<Action<T>> action) where T : class
{
@tallseth
tallseth / EF_TDD.cs
Created December 20, 2011 03:37
Entity framework unit test problem
//works
public void Update(Job job)
{
//How do you unit test this line without communicating with a DB?
context_.Entry(job).State = EntityState.Modified;
context_.SaveChanges();
}
//doesn't work
public void Update(Job job)