typhoon

Typhoon: How to get an instance conforming to a protocol for production, and another for tests?

假装没事ソ 提交于 2019-12-07 07:41:42
问题 I've defined an ApplicationAssembly in Typhoon. So what I want to do is say: "This class X needs to be injected with something conforming to the Foo protocol. This is a RealFoo, this is a TestFoo. When I'm running X in real life, I want it to get a RealFoo, but when I'm running my integration tests, I want it to get a TestFoo". How can I do this? 回答1: There are several recommended ways to do this: Use the Typhoon Patcher Typhoon-patcher allows loading a base assembly, but with one or more

How to inject fake, stubbed or mock dependencies for Integration tests using Typhoon

*爱你&永不变心* 提交于 2019-12-06 01:23:54
I'm trying to write integration tests using KIF. My question is: How to inject stubbed, mock or fake dependency for particular view controller? Each view controller using dependencies like a data model, http client, store manager etc. comes from ModelAssembly, ApplicationAssembly, ManagerAssmebly. On storyboard, for login view i have a key path, containing value "loginViewController". Creating view controllers: ViewControllersAssembly.h @interface ViewControllersAssembly : TyphoonAssembly @property (nonatomic, strong) ModelAssembly *modelAssembly; - (id)loginViewController; @end

Typhoon: How to get an instance conforming to a protocol for production, and another for tests?

旧街凉风 提交于 2019-12-05 13:58:33
I've defined an ApplicationAssembly in Typhoon. So what I want to do is say: "This class X needs to be injected with something conforming to the Foo protocol. This is a RealFoo, this is a TestFoo. When I'm running X in real life, I want it to get a RealFoo, but when I'm running my integration tests, I want it to get a TestFoo". How can I do this? There are several recommended ways to do this: Use the Typhoon Patcher Typhoon-patcher allows loading a base assembly, but with one or more components patched out with another definition, or a given object instance. Here's an example of patching out a

Swift: Cannot use library from Pod file

蹲街弑〆低调 提交于 2019-12-04 00:48:36
问题 I'm using Typhoon library for Dependency Injection Framework. I use CocoaPod for installing this library. Here is my pod file: target "typhoon-swift-demo" do pod 'Typhoon' end target "typhoon-swift-demoTests" do end I have installed successfully but when I open workspace project file. I type those line of code as Typhoon sample code: public class ApplicationAssembly: TyphoonAssembly { } I meet error that my application doesn't recognize TyphoonAssembly I have tried to use some lines such as:

Typhoon with Storyboard, instantiating ViewController

佐手、 提交于 2019-12-02 10:38:10
问题 When working with storyboards in Typhoon, if I do something like this in the assembly - (id)myController { return [TyphoonDefinition withClass:[BigController class] configuration:^(TyphoonDefinition *definition) { [definition injectProperty:@selector(dao) with:[_dataAssembly dao]]; }]; } Later I want the factory to hand me the controller from the Typhoon story board however I end up with the plain controller created using alloc/init vc= [_factory componentForType:[BigController class]]; In

Typhoon with Storyboard, instantiating ViewController

落爺英雄遲暮 提交于 2019-12-02 04:05:33
When working with storyboards in Typhoon, if I do something like this in the assembly - (id)myController { return [TyphoonDefinition withClass:[BigController class] configuration:^(TyphoonDefinition *definition) { [definition injectProperty:@selector(dao) with:[_dataAssembly dao]]; }]; } Later I want the factory to hand me the controller from the Typhoon story board however I end up with the plain controller created using alloc/init vc= [_factory componentForType:[BigController class]]; In AppDelegate I am using the typhoon storyboard as follows TyphoonComponentFactory *factory = [

Typhoon not injecting property (without storyboard)

佐手、 提交于 2019-12-01 22:17:01
I cannot get properties injected into view controllers using XIBs with initWithNibName:bundle: Example: This is my assembly: @implementation AppAssembly - (ViewControllerC *)viewControllerC { return [TyphoonDefinition withClass:[ViewControllerC class] configuration:^(TyphoonDefinition *definition) { [definition injectProperty:@selector(name) with:@"Injected string"]; }]; } @end ViewControllerA code: @implementation ViewControllerA - (IBAction)buttonAction:(id)sender { ViewControllerB *viewControllerB = [[ViewControllerB alloc] initWithNibName:@"ViewControllerB" bundle:nil]; [self

Swift: Cannot use library from Pod file

╄→гoц情女王★ 提交于 2019-12-01 03:38:07
I'm using Typhoon library for Dependency Injection Framework. I use CocoaPod for installing this library. Here is my pod file: target "typhoon-swift-demo" do pod 'Typhoon' end target "typhoon-swift-demoTests" do end I have installed successfully but when I open workspace project file. I type those line of code as Typhoon sample code: public class ApplicationAssembly: TyphoonAssembly { } I meet error that my application doesn't recognize TyphoonAssembly I have tried to use some lines such as: import Typhoon // not recogize typhoon import TyphoonAssembly // not regconize Please tell me how to

Swift TyphoonBlockComponentFactory Error in XCTest

人走茶凉 提交于 2019-11-29 14:19:27
i’m using Swift with Typhoon and Cocoapods. Everything worked well until i started to write an Integrationtest (according to the Typhoon-Example-App Test ) for my Typhoon component. I wanted to setup the TyphoonFactory in the Test setUp() method in the same way as i did in the AppDelegate . When i execute the test i always get a TyphoonBlockComponentFactory assertIsAssembly:] + 244: ERROR: MyApp.MyAssembly is not a sub-class of TyphoonAssembly error thrown by Typhoon (wich is using the kindOfClass method under the hood.) The same code is working perfectly in the AppDelegate and i can’t figure

Swift TyphoonBlockComponentFactory Error in XCTest

社会主义新天地 提交于 2019-11-28 08:19:39
问题 i’m using Swift with Typhoon and Cocoapods. Everything worked well until i started to write an Integrationtest (according to the Typhoon-Example-App Test) for my Typhoon component. I wanted to setup the TyphoonFactory in the Test setUp() method in the same way as i did in the AppDelegate . When i execute the test i always get a TyphoonBlockComponentFactory assertIsAssembly:] + 244: ERROR: MyApp.MyAssembly is not a sub-class of TyphoonAssembly error thrown by Typhoon (wich is using the