コード例 #1
0
        private static object CreateTypeFromAssembly <T>(Assembly assembly, params object[] parameters)
        {
            Type   typeFromAssembly = IndexingPolicyTests.GetTypeFromAssembly(assembly, typeof(T).Name);
            object createdType      = Activator.CreateInstance(typeFromAssembly, parameters);

            if (createdType == null)
            {
                Assert.Fail($"Failed to construct type of {nameof(T)} from assembly:{assembly.GetName().Name} using parameters: {parameters}");
            }

            return(createdType);
        }
コード例 #2
0
        private static IndexingPolicy GetIndexingPolicyFromAssembly(Assembly assembly, object indexingPolicy)
        {
            Type indexingPolicyType = IndexingPolicyTests.GetTypeFromAssembly(assembly, "IndexingPolicy");

            return(JsonConvert.DeserializeObject <IndexingPolicy>(JsonConvert.SerializeObject(indexingPolicy, indexingPolicyType, null)));
        }