public void WhenActivationDelegateReturnsNull_ExceptionDescribesLimitType() { var target = new DelegateActivator(typeof(string), (c, p) => null); var ex = Assert.Throws<DependencyResolutionException>( () => target.ActivateInstance(new ContainerBuilder().Build(), Enumerable.Empty<Parameter>())); Assert.That(ex.Message.Contains(typeof(string).ToString())); }
public void ActivateInstance_ReturnsResultOfInvokingSuppliedDelegate() { var instance = new object(); var target = new DelegateActivator(typeof(object), (c, p) => instance); Assert.AreSame(instance, target.ActivateInstance(new ContainerBuilder().Build(), Enumerable.Empty<Parameter>())); }