public void NullContext() { ActivatorCreationPolicy policy = new ActivatorCreationPolicy(); Assert.Throws<ArgumentNullException>( delegate { policy.Create(null, typeof(Dummy)); }); }
public void CreatesObjectAndPassesValue() { MockBuilderContext context = new MockBuilderContext(); ActivatorCreationPolicy policy = new ActivatorCreationPolicy(Params(42)); Dummy result = (Dummy)policy.Create(context, typeof(Dummy)); Assert.NotNull(result); Assert.Equal(42, result.val); }
public void NoMatchingConstructor() { MockBuilderContext context = new MockBuilderContext(); ActivatorCreationPolicy policy = new ActivatorCreationPolicy(Params("foo")); Assert.Throws<MissingMethodException>( delegate { policy.Create(context, typeof(Dummy)); }); }