public void ShouldCreateAndEvaluateUntypedTest() { 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); Assert.AreEqual(DependencyLifetime.Transient, transientFactoryMethodDependencyResolution.DependencyLifetime); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(int), string.Empty); Assert.IsNotNull(result); Assert.AreEqual(11, result); transientFactoryMethodDependencyResolution.Dispose(); mockFactory.VerifyAllExpectationsHaveBeenMet(); }
public void ShouldCreateAndEvaluateTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func <int> value; Func <ValueTask <int> > asyncValue; int result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = mockFactory.CreateInstance <IDependencyManager>(); value = () => 11; asyncValue = async() => await Task.FromResult <int>(7); transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value, asyncValue); Assert.AreEqual(DependencyLifetime.Transient, transientFactoryMethodDependencyResolution.DependencyLifetime); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, string.Empty); Assert.IsNotNull(result); Assert.AreEqual(11, result); transientFactoryMethodDependencyResolution.Dispose(); mockFactory.VerifyAllExpectationsHaveBeenMet(); }
public void ShouldFailOnNullFactoryMethodCreateTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; Func <int> value; value = null; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value); }
public void ShouldFailOnNullFactoryMethodCreateTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; Func <int> value; Func <ValueTask <int> > asyncValue; value = null; asyncValue = async() => await Task.FromResult <int>(7); transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value, asyncValue); }
public void ShouldFailOnNullFactoryMethodCreateAsyncTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; Func <int> value; Func <ValueTask <int> > asyncValue; value = () => 11; asyncValue = null; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value, asyncValue); }
public void ShouldFailOnNullDependencyManagerResolveTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func <int> value; int result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = null; value = () => 11; transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, string.Empty); }
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); }
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 ShouldFailOnNullKeyResolveUntypedTest() { TransientFactoryMethodDependencyResolution <int> transientFactoryMethodDependencyResolution; IDependencyManager mockDependencyManager; Func <int> value; Func <ValueTask <int> > asyncValue; object result; MockFactory mockFactory; mockFactory = new MockFactory(); mockDependencyManager = mockFactory.CreateInstance <IDependencyManager>(); value = () => 11; asyncValue = async() => await Task.FromResult <int>(7); transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution <int>(value, asyncValue); result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(int), null); }