/// <summary> /// Initialize resolver factory /// </summary> /// <param name="resolverFactory"></param> private static void InitResolverFactory(IResolverFactory resolverFactory) { lock (_setLocker) { _dependencyResolverFactory = resolverFactory; _dependencyResolverFactory.CreateResolver(); _resolver = _dependencyResolverFactory.GetResolver(); _isInited = true; } }
// TODO: issues 147: [DynamicData(nameof(GetOptionalParametersData), DynamicDataSourceType.Method)] public void OptionalNoDefaultTest(IResolverFactory <ParameterInfo> factory) { var context = new DictionaryContext() as IResolveContext; var resolver = factory.GetResolver <IResolveContext>(NoDefaultInfo); // Validate Assert.IsNotNull(resolver); Assert.IsNull(resolver(ref context)); }
public void OptionalExceptionTest(IResolverFactory <Type> factory) { var context = new DictionaryContext() as IResolveContext; var resolver = factory.GetResolver <IResolveContext>(typeof(string)); // Validate Assert.IsNotNull(resolver); Assert.IsNull(resolver(ref context)); }
public void OptionalCircularExceptionInfoTest(IResolverFactory <ParameterInfo> factory) { var context = new CircularExceptionContect() as IResolveContext; var resolver = factory.GetResolver <IResolveContext>(NoDefaultInfo); // Validate Assert.IsNotNull(resolver); _ = resolver(ref context); }
public void OptionalCircularExceptionTest(IResolverFactory <Type> factory) { var context = new CircularExceptionContect() as IResolveContext; var resolver = factory.GetResolver <IResolveContext>(typeof(string)); // Validate Assert.IsNotNull(resolver); _ = resolver(ref context); }
// TODO: issues 147: [DynamicData(nameof(GetOptionalParametersData), DynamicDataSourceType.Method)] public void OptionalDefaultTest(IResolverFactory <ParameterInfo> factory) { var context = new DictionaryContext() as IResolveContext; var resolver = factory.GetResolver <IResolveContext>(DefaultInfo); // Validate Assert.IsNotNull(resolver); var value = resolver(ref context); Assert.AreEqual(DefaultValue, value); }
public void TypeArrayTest(IResolverFactory <Type> factory) { // Act var resolver = factory.GetResolver <IResolveContext>(ArrayInfo.ParameterType); // Validate Assert.IsNotNull(resolver); var value = resolver(ref Context) as List <string>[]; Assert.IsNotNull(value); Assert.AreSame(ListArrayConst[0], value[0]); }
public void TypeFactoryTest(IResolverFactory <Type> factory) { // Act var resolver = factory.GetResolver <IResolveContext>(FirstInfo.ParameterType); // Validate Assert.IsNotNull(resolver); var value = resolver(ref Context) as List <string>; Assert.IsNotNull(value); Assert.AreSame(ListConst, value); }
public void InfoObjectTest(IResolverFactory <ParameterInfo> factory) { // Act var resolver = factory.GetResolver <IResolveContext>(ObjectInfo); // Validate Assert.IsNotNull(resolver); var value = resolver(ref Context) as List <string>[]; Assert.IsNotNull(value); Assert.AreSame(ListArrayConst[0], value[0]); }
public void TypeObjectTest(IResolverFactory <Type> factory) { // Act var resolver = factory.GetResolver <IResolveContext>(ObjectInfo.ParameterType); // Validate Assert.IsNotNull(resolver); var array = resolver(ref Context) as List <string>[]; Assert.IsNotNull(array); Assert.IsTrue(0 < array.Length); Assert.AreEqual(ListArrayConst[0], array[0]); }