react-native-navigation的迁移库

UIViewController+LayoutProtocolTest.m 1010B

123456789101112131415161718192021222324252627282930313233343536
  1. #import <XCTest/XCTest.h>
  2. #import <OCMock/OCMock.h>
  3. #import "UIViewController+LayoutProtocol.h"
  4. @interface UIViewController_LayoutProtocolTest : XCTestCase
  5. @property (nonatomic, retain) UIViewController* uut;
  6. @end
  7. @implementation UIViewController_LayoutProtocolTest
  8. - (void)setUp {
  9. [super setUp];
  10. self.uut = [OCMockObject partialMockForObject:[UIViewController new]];
  11. self.uut.layoutInfo = [[RNNLayoutInfo alloc] init];
  12. self.uut.layoutInfo.componentId = @"componentId";
  13. }
  14. - (void)testSetStoreShouldSaveComponent {
  15. RNNStore* store = [[RNNStore alloc] init];
  16. [self.uut setStore:store];
  17. XCTAssertNotNil([store findComponentForId:self.uut.layoutInfo.componentId]);
  18. }
  19. - (void)testDeallocShouldRemoveComponentFromStore {
  20. RNNStore* store = [[RNNStore alloc] init];
  21. [self.uut setStore:store];
  22. XCTAssertNotNil([store findComponentForId:self.uut.layoutInfo.componentId]);
  23. self.uut = nil;
  24. XCTAssertNil([store findComponentForId:self.uut.layoutInfo.componentId]);
  25. }
  26. @end