public void ShouldCreateAndEvaluateTest() { TransientFactoryMethodDependencyResolution transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func<object> value; object result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>(); value = () => 11; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution(value); Assert.AreEqual(DependencyLifetime.Transient, transientFactoryMethodDependencyResolution.DependencyLifetime); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty); Assert.IsNotNull(result); Assert.AreEqual(11, result); transientFactoryMethodDependencyResolution.Dispose(); mockFactory.VerifyAllExpectationsHaveBeenMet(); }
public void ShouldFailOnNullDependencyManagerResolveTest() { TransientFactoryMethodDependencyResolution transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func<object> value; object result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = null; value = () => 11; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution(value); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty); }
public void ShouldFailOnNullKeyResolveTest() { TransientFactoryMethodDependencyResolution transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func<object> value; object result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>(); value = () => 11; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution(value); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(object), null); }
public void ShouldFailOnNullFactoryMethodCreateTest() { TransientFactoryMethodDependencyResolution transientFactoryMethodDependencyResolution; Func<object> value; value = null; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution(value); }
public void ShouldFailOnNullTypeResolveUntypedTest() { TransientFactoryMethodDependencyResolution<int> transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func<int> value; object result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>(); value = () => 11; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution<int>(value); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, null, string.Empty); }