Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
0935d49b
Commit
0935d49b
authored
May 24, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve test coverage for BUYOperation subclasses.
parent
7b5cf27c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
117 additions
and
3 deletions
+117
-3
BUYOperationTests.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOperationTests.m
+75
-0
BUYRequestOperationTests.m
...e Buy SDK/Mobile Buy SDK Tests/BUYRequestOperationTests.m
+36
-3
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+6
-0
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOperationTests.m
0 → 100644
View file @
0935d49b
//
// BUYOperationTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "BUYOperation.h"
@interface
BUYOperationTests
:
XCTestCase
@end
@implementation
BUYOperationTests
#pragma mark - Init -
-
(
void
)
testInit
{
BUYOperation
*
operation
=
[[
BUYOperation
alloc
]
init
];
XCTAssertNotNil
(
operation
);
}
#pragma mark - State -
-
(
void
)
testNormalExecutionFlow
{
BUYOperation
*
operation
=
[[
BUYOperation
alloc
]
init
];
XCTAssertTrue
(
operation
.
isReady
);
[
operation
start
];
XCTAssertTrue
(
operation
.
isExecuting
);
[
operation
finishExecution
];
XCTAssertTrue
(
operation
.
isFinished
);
XCTAssertFalse
(
operation
.
isCancelled
);
}
-
(
void
)
testCancelledExecutionFlow
{
BUYOperation
*
operation
=
[[
BUYOperation
alloc
]
init
];
XCTAssertTrue
(
operation
.
isReady
);
[
operation
start
];
XCTAssertTrue
(
operation
.
isExecuting
);
[
operation
cancel
];
XCTAssertTrue
(
operation
.
isCancelled
);
XCTAssertTrue
(
operation
.
isFinished
);
[
operation
cancelExecution
];
XCTAssertTrue
(
operation
.
isFinished
);
}
@end
Mobile Buy SDK/Mobile Buy SDK Tests/BUYRequestOperationTests.m
View file @
0935d49b
...
...
@@ -2,8 +2,26 @@
// BUYRequestOperationTests.m
// Mobile Buy SDK
//
// Created by Dima Bart on 2016-05-16.
// Copyright © 2016 Shopify Inc. All rights reserved.
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
...
...
@@ -239,8 +257,8 @@
[
self
createExpectationDelay
];
[
operation
cancel
];
[
self
.
queue
addOperation
:
operation
];
[
operation
cancel
];
[
self
waitForExpectationsWithTimeout
:
3
.
0
handler
:
nil
];
}
...
...
@@ -262,6 +280,21 @@
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
nil
];
}
-
(
void
)
testCancellationWithoutQueue
{
[
self
stubRequestsWithDelay
:
0
.
5
];
BUYRequestOperation
*
operation
=
[
self
operationFulfillingExpectation
:
nil
completion
:
^
{
XCTAssert
(
NO
,
@"Operation should not call completion if cancelled."
);
}];
[
operation
start
];
[
operation
cancel
];
[
self
createExpectationDelay
];
[
self
waitForExpectationsWithTimeout
:
4
.
0
handler
:
nil
];
}
-
(
void
)
testCancellationDuringPolling
{
[
self
stubRequestsWithDelay
:
0
.
1
status
:
BUYStatusProcessing
];
...
...
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
0935d49b
...
...
@@ -389,6 +389,7 @@
B2653EC51CEF55CC0012D57D
/* BUYModelManager+ApplePay.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
B2653EC21CEF55CC0012D57D
/* BUYModelManager+ApplePay.m */
;
};
B2653EC61CEF55CC0012D57D
/* BUYModelManager+ApplePay.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
B2653EC21CEF55CC0012D57D
/* BUYModelManager+ApplePay.m */
;
};
B2653EC71CEF55CC0012D57D
/* BUYModelManager+ApplePay.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
B2653EC21CEF55CC0012D57D
/* BUYModelManager+ApplePay.m */
;
};
9A7652C31CF487BD00220E4B
/* BUYOperationTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A7652C21CF487BD00220E4B
/* BUYOperationTests.m */
;
};
BE47340F1B66C4EF00AA721A
/* BUYError.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE47340D1B66C4EF00AA721A
/* BUYError.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
BE4734101B66C4EF00AA721A
/* BUYError.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE47340E1B66C4EF00AA721A
/* BUYError.m */
;
};
BE5DC3631B71022D00B2BC1E
/* BUYMaskedCreditCard.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
BE5DC3611B71022D00B2BC1E
/* BUYMaskedCreditCard.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -676,6 +677,9 @@
B2653EC21CEF55CC0012D57D
/* BUYModelManager+ApplePay.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
"BUYModelManager+ApplePay.m"
;
sourceTree
=
"<group>"
;
};
BE33B4ED1B15FF4D0067982B
/* BUYApplePayAuthorizationDelegate.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYApplePayAuthorizationDelegate.h
;
sourceTree
=
"<group>"
;
};
BE33B4EE1B15FF4D0067982B
/* BUYApplePayAuthorizationDelegate.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYApplePayAuthorizationDelegate.m
;
sourceTree
=
"<group>"
;
};
9A7652C21CF487BD00220E4B
/* BUYOperationTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYOperationTests.m
;
sourceTree
=
"<group>"
;
};
BE33B4ED1B15FF4D0067982B
/* BUYApplePayHelpers.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYApplePayHelpers.h
;
sourceTree
=
"<group>"
;
};
BE33B4EE1B15FF4D0067982B
/* BUYApplePayHelpers.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYApplePayHelpers.m
;
sourceTree
=
"<group>"
;
};
BE47340D1B66C4EF00AA721A
/* BUYError.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYError.h
;
sourceTree
=
"<group>"
;
};
BE47340E1B66C4EF00AA721A
/* BUYError.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYError.m
;
sourceTree
=
"<group>"
;
};
BE5DC3611B71022D00B2BC1E
/* BUYMaskedCreditCard.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYMaskedCreditCard.h
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1006,6 +1010,7 @@
9A0B0C611CE9F8310037D68F
/* Operation Tests */
=
{
isa
=
PBXGroup
;
children
=
(
9A7652C21CF487BD00220E4B
/* BUYOperationTests.m */
,
9A0B0C621CE9F8530037D68F
/* BUYRequestOperationTests.m */
,
);
name
=
"Operation Tests"
;
...
...
@@ -1723,6 +1728,7 @@
BE98DB5C1BB1F4D000C29564
/* OHHTTPStubsResponse+Helpers.m in Sources */
,
849110311CCE708900E53B93
/* BUYArrayAdditionsTests.m in Sources */
,
9A0B0C631CE9F8530037D68F
/* BUYRequestOperationTests.m in Sources */
,
9A7652C31CF487BD00220E4B
/* BUYOperationTests.m in Sources */
,
8498DCCF1CDD208200BD12A8
/* BUYTestModel.xcdatamodeld in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment