public void NullReferenceException_When_Invoking() { Duck source = null; IDuck target = source.As <IDuck>(); Assert.NotNull(target); Assert.Throws <NullReferenceException>(() => target.Quack()); }
public void Null_Can_Be_Goosed() { Duck source = null; IDuck target = source.As <IDuck>(); Assert.NotNull(target); Assert.Null(target.GetSource <Duck>()); }
public void Should_Use_Original_Object() { Duck source = new Duck(); IDuck target = source.As <IDuck>(); Assert.Same(source, target); Assert.Same(source, target.GetSource <Duck>()); Assert.Throws <ArgumentException>(() => target.GetSource <ExecitedDuck>()); }