We created a defaultFactory function for a limited number of cases. The main thing:
- Gaining access to Typhoon and finding dependencies for a class that is not managed by Typhoon. This is usually not required.
Although you can use it in tests, we recommend that you instead create and destroy a Typhoon container for each test run. To avoid duplication, you can create a method as follows:
@implementation IntegrationTestUtils + (TyphoonComponentFactory*)testAssembly { TyphoonComponentFactory* factory = [[TyphoonBlockComponentFactory alloc] initWithAssemblies:@[ [MyAppAssembly assembly], [MyAppKernel assembly], [MyAppNetworkComponents assembly], [MyAppPersistenceComponents assembly] ]]; id <TyphoonResource> configurationProperties = [TyphoonBundleResource withName:@"Configuration.properties"]; [factory attachPostProcessor:[TyphoonPropertyPlaceholderConfigurer configurerWithResource:configurationProperties]]; return factory; }
., if necessary, you can attach a patcher to this assembly.
Attaching a patcher to factory default:
If you want to apply the patcher to the default assembly, most likely you will want to remove the patch again. This feature is in the backlog here .
Jasper blues
source share