123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #import <XCTest/XCTest.h>
- #import <OCMock/OCMock.h>
- #import "RNNSideMenuPresenter.h"
- #import "RNNSideMenuController.h"
-
- @interface RNNSideMenuPresenterTest : XCTestCase
-
- @property (nonatomic, strong) RNNSideMenuPresenter *uut;
- @property (nonatomic, strong) RNNNavigationOptions *options;
- @property (nonatomic, strong) id bindedViewController;
-
- @end
-
- @implementation RNNSideMenuPresenterTest
-
- - (void)setUp {
- [super setUp];
- self.uut = [[RNNSideMenuPresenter alloc] init];
- self.bindedViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
- [self.uut bindViewController:self.bindedViewController];
- self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
- }
-
- - (void)testApplyOptionsShouldSetDefaultValues {
- [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:YES];
- [[self.bindedViewController expect] side:MMDrawerSideRight enabled:YES];
- [[self.bindedViewController expect] setShouldStretchLeftDrawer:YES];
- [[self.bindedViewController expect] setShouldStretchRightDrawer:YES];
- [[self.bindedViewController expect] setAnimationVelocityLeft:840.0f];
- [[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
- [[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
- [[self.bindedViewController reject] side:MMDrawerSideRight width:0];
- [[self.bindedViewController expect] setAnimationType:nil];
-
- [self.uut applyOptions:self.options];
-
- [self.bindedViewController verify];
- }
-
- - (void)testApplyOptionsShouldSetInitialValues {
- self.options.sideMenu.left.enabled = [[Bool alloc] initWithBOOL:NO];
- self.options.sideMenu.right.enabled = [[Bool alloc] initWithBOOL:NO];
- self.options.sideMenu.left.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
- self.options.sideMenu.right.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
- self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
- self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
- self.options.sideMenu.right.width = [[Double alloc] initWithValue:@(100.0f)];
- self.options.sideMenu.left.width = [[Double alloc] initWithValue:@(100.0f)];
-
- [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:NO];
- [[self.bindedViewController expect] side:MMDrawerSideRight enabled:NO];
- [[self.bindedViewController expect] setShouldStretchLeftDrawer:NO];
- [[self.bindedViewController expect] setShouldStretchRightDrawer:NO];
- [[self.bindedViewController expect] setAnimationVelocityLeft:100.0f];
- [[self.bindedViewController expect] setAnimationVelocityRight:100.0f];
- [[self.bindedViewController expect] side:MMDrawerSideLeft width:100.0f];
- [[self.bindedViewController expect] side:MMDrawerSideRight width:100.0f];
-
- [self.uut applyOptions:self.options];
-
- [self.bindedViewController verify];
- }
-
-
- @end
|