Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Heber Lazcano committed Jun 25, 2014
1 parent 7893cef commit b092fa5
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 19 deletions.
6 changes: 1 addition & 5 deletions Openpay.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
ORGANIZATIONNAME = "Openpay S.A.P.I. de C.V.";
TargetAttributes = {
90F8ED801958A81E00795E61 = {
TestTargetID = 90F8EDE21959006E00795E61;
TestTargetID = 90F8ED701958A81E00795E61;
};
90F8EDE21959006E00795E61 = {
SystemCapabilities = {
Expand Down Expand Up @@ -600,7 +600,6 @@
90F8ED981958A81E00795E61 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/OpenpayExample.app/OpenpayExample";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -614,15 +613,13 @@
);
INFOPLIST_FILE = "OpenpayTests/OpenpayTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Debug;
};
90F8ED991958A81E00795E61 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/OpenpayExample.app/OpenpayExample";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -632,7 +629,6 @@
GCC_PREFIX_HEADER = "Openpay/Openpay-Prefix.pch";
INFOPLIST_FILE = "OpenpayTests/OpenpayTests-Info.plist";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
};
name = Release;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90F8ED701958A81E00795E61"
BuildableName = "libOpenpay.a"
BlueprintName = "Openpay"
BlueprintIdentifier = "907129FE195A46CA00EB5D24"
BuildableName = "openpay"
BlueprintName = "openpay"
ReferencedContainer = "container:Openpay.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90F8ED801958A81E00795E61"
BuildableName = "OpenpayTests.xctest"
BlueprintName = "OpenpayTests"
ReferencedContainer = "container:Openpay.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
Expand All @@ -21,8 +37,21 @@
BlueprintName = "OpenpayTests"
ReferencedContainer = "container:Openpay.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "Mexico City, Mexico"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "90F8EDE21959006E00795E61"
BuildableName = "OpenpayExample.app"
BlueprintName = "OpenpayExample"
ReferencedContainer = "container:Openpay.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>Openpay.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>1</integer>
</dict>
<key>OpenpayExample.xcscheme</key>
<dict>
Expand All @@ -17,12 +17,12 @@
<key>OpenpayTests.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>3</integer>
</dict>
<key>openpay.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>2</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down
14 changes: 7 additions & 7 deletions OpenpayTests/OPCardTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ - (void)testVisaCardType {
NSString *cardNumber = @"41111111111111111";
OPCard *card = [[OPCard alloc] init];
card.number = cardNumber;
XCTAssertTrue(card.type==OPCardTypeVisa, @"Card type should be %@ but was %lu", @"Visa", card.type);
XCTAssertTrue(card.type==OPCardTypeVisa, @"Card type should be %@ but was %u", @"Visa", card.type);
}

- (void)testMastercardCardType {
NSString *cardNumber = @"5105105105105100";
OPCard *card = [[OPCard alloc] init];
card.number = cardNumber;
XCTAssertTrue(card.type==OPCardTypeMastercard, @"Card type should be %@ but was %lu", @"Mastercard", card.type);
XCTAssertTrue(card.type==OPCardTypeMastercard, @"Card type should be %@ but was %u", @"Mastercard", card.type);
}

- (void)testAmericanExpressCardType {
NSString *cardNumber = @"341111111111111";
OPCard *card = [[OPCard alloc] init];
card.number = cardNumber;
XCTAssertTrue(card.type==OPCardTypeAmericanExpress, @"Card type should be %@ but was %lu", @"American Express", card.type);
XCTAssertTrue(card.type==OPCardTypeAmericanExpress, @"Card type should be %@ but was %u", @"American Express", card.type);
}

// Test card numbers
Expand Down Expand Up @@ -120,16 +120,16 @@ - (void)testNonExpiredCardExpiresThisYear {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]];
OPCard *card = [[OPCard alloc] init];
card.number = @"4111111111111111";
card.expirationMonth = [NSString stringWithFormat: @"%ld", components.month + 1];
card.expirationYear = [NSString stringWithFormat:@"%ld", components.year];
card.expirationMonth = [NSString stringWithFormat: @"%d", components.month + 1];
card.expirationYear = [NSString stringWithFormat:@"%d", components.year];
XCTAssertFalse(card.expired, @"Card should not be expired");
}

- (void)testExpiredCardExpiredMonth {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]];
OPCard *card = [[OPCard alloc] init];
card.number = @"4111111111111111";
card.expirationMonth = [NSString stringWithFormat: @"%ld", components.month - 1];
card.expirationMonth = [NSString stringWithFormat: @"%d", components.month - 1];
card.expirationYear = [NSString stringWithFormat:@"%ld", (long)components.year];
XCTAssertTrue(card.expired, @"Card should be expired");
}
Expand All @@ -139,7 +139,7 @@ - (void)testExpiredCardExpiredYear {
OPCard *card = [[OPCard alloc] init];
card.number = @"4111111111111111";
card.expirationMonth = @"08";
card.expirationYear = [NSString stringWithFormat:@"%ld", components.year - 1];
card.expirationYear = [NSString stringWithFormat:@"%d", components.year - 1];
XCTAssertTrue(card.expired, @"Card should be expired");
}

Expand Down

0 comments on commit b092fa5

Please sign in to comment.