protected static ResolvedInjectionConfiguration ExecuteSimpleTest(
     InjectedMethod injectedMethod,
     string injecteeMethodName,
     bool assertFirstMethodMatch = true)
 {
     return(ExecuteSimpleTest(new[] { injectedMethod }, new[] { injecteeMethodName }, assertFirstMethodMatch));
 }
Beispiel #2
0
        private void AttemptInjectUsesThirdPartyLibraryBase(bool setThirdPartyLibraryPath)
        {
            InjectedMethod injectedMethod =
                new InjectedMethod(
                    InjectedLibraryPath,
                    $"{typeof(TestInjectedMethods).FullName}.{nameof(TestInjectedMethods.UsesThirdPartyLibrary)}"
                    );

            InjectionConfiguration configuration = IntegrationTestsHelper.GetBasicInjectionConfiguration(false, false, injectedMethod);

            configuration =
                configuration
                .WithInjecteeAssemblies(
                    configuration.InjecteeAssemblies.Select(
                        assembly => {
                List <IAllowedAssemblyReference> list = assembly.AllowedAssemblyReferences.ToList();
                list.Add(
                    new AllowedAssemblyReference(
                        "Tests.ThirdPartyLibrary",
                        false,
                        setThirdPartyLibraryPath ? "Tests.ThirdPartyLibrary.Different.dll" : null));
                List <IIgnoredMemberReference> list2 = assembly.IgnoredMemberReferences.ToList();
                list2.Add(new IgnoredMemberReference("some filter"));
                assembly =
                    assembly
                    .WithAllowedAssemblyReferences(list.AsReadOnly())
                    .WithIgnoredMemberReferences(list2.AsReadOnly());
                return(assembly);
            })
                    .ToList().AsReadOnly()
                    );

            ExecuteSimpleTest(
                configuration,
                new[] { $"{InjecteeClassName}.{nameof(TestInjectee.SingleStatement)}" },
                false
                );
        }