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
5c1feefe
Commit
5c1feefe
authored
8 years ago
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add BUYOptionValue tests.
parent
1f5e077c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
1 deletions
+91
-1
BUYOptionValueTests.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOptionValueTests.m
+78
-0
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+13
-1
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOptionValueTests.m
0 → 100644
View file @
5c1feefe
//
// BUYOptionValueTests.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 "BUYOptionValue.h"
@interface
BUYOptionValueTests
:
XCTestCase
@end
@implementation
BUYOptionValueTests
-
(
void
)
testInitWithValidData
{
NSDictionary
*
json
=
[
self
jsonWithID
:
@84935
optionID
:
@749
];
BUYOptionValue
*
value
=
[[
BUYOptionValue
alloc
]
initWithDictionary
:
json
];
XCTAssertNotNil
(
value
);
XCTAssertEqualObjects
(
value
.
identifier
,
json
[
@"id"
]);
XCTAssertEqualObjects
(
value
.
name
,
json
[
@"name"
]);
XCTAssertEqualObjects
(
value
.
value
,
json
[
@"value"
]);
XCTAssertEqualObjects
(
value
.
optionId
,
json
[
@"option_id"
]);
}
-
(
void
)
testEqualOptions
{
BUYOptionValue
*
value1
=
[
self
optionValueWithID
:
@123
optionID
:
@321
];
BUYOptionValue
*
value2
=
[
self
optionValueWithID
:
@123
optionID
:
@321
];
XCTAssertNotEqual
(
value1
,
value2
);
// Pointer comparison, different objects
XCTAssertEqualObjects
(
value1
,
value2
);
XCTAssertEqual
(
value1
.
hash
,
value2
.
hash
);
}
-
(
void
)
testIdenticalOptions
{
BUYOptionValue
*
value1
=
[
self
optionValueWithID
:
@123
optionID
:
@321
];
BUYOptionValue
*
value2
=
value1
;
XCTAssertEqual
(
value1
,
value2
);
XCTAssertTrue
([
value1
isEqual
:
value2
]);
}
#pragma mark - Convenience -
-
(
BUYOptionValue
*
)
optionValueWithID
:
(
NSNumber
*
)
identifier
optionID
:
(
NSNumber
*
)
optionID
{
return
[[
BUYOptionValue
alloc
]
initWithDictionary
:[
self
jsonWithID
:
identifier
optionID
:
optionID
]];
}
-
(
NSDictionary
*
)
jsonWithID
:
(
NSNumber
*
)
identifier
optionID
:
(
NSNumber
*
)
optionID
{
return
@{
@"id"
:
@19483
,
@"name"
:
@"option1"
,
@"value"
:
@"value1"
,
@"option_id"
:
@543
,
};
}
@end
This diff is collapsed.
Click to expand it.
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
5c1feefe
...
...
@@ -297,6 +297,7 @@
90F5930A1B0D5F4C0026B382
/* BUYLineItemTest.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FE1B0D5F4C0026B382
/* BUYLineItemTest.m */
;
};
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
;
};
9A102D1B1CDD1F960026CC43
/* BUYErrorTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
;
};
9A102D1E1CDD25980026CC43
/* BUYOptionValueTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
;
};
9A3B2DC91CD27D5B00BFF49C
/* BUYCustomer.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A3B2DCA1CD27D5B00BFF49C
/* BUYCustomer.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A3B2DCB1CD27D5B00BFF49C
/* BUYCustomer.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC81CD27D5B00BFF49C
/* BUYCustomer.m */
;
};
...
...
@@ -602,6 +603,7 @@
90FC31A61B50371600AFAB51
/* BUYProductViewHeaderBackgroundImageView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
lineEnding
=
0
;
name
=
BUYProductViewHeaderBackgroundImageView.h
;
path
=
"Product View/BUYProductViewHeaderBackgroundImageView.h"
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.objcpp
;
};
90FC31A71B50371600AFAB51
/* BUYProductViewHeaderBackgroundImageView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
BUYProductViewHeaderBackgroundImageView.m
;
path
=
"Product View/BUYProductViewHeaderBackgroundImageView.m"
;
sourceTree
=
"<group>"
;
};
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYErrorTests.m
;
sourceTree
=
"<group>"
;
};
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYOptionValueTests.m
;
sourceTree
=
"<group>"
;
};
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYCustomer.h
;
sourceTree
=
"<group>"
;
};
9A3B2DC81CD27D5B00BFF49C
/* BUYCustomer.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYCustomer.m
;
sourceTree
=
"<group>"
;
};
9A3B2DCD1CD2822F00BFF49C
/* BUYClient+Customers.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"BUYClient+Customers.h"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -852,6 +854,7 @@
90F592ED1B0D5EFE0026B382
/* Mobile Buy SDK Tests */
=
{
isa
=
PBXGroup
;
children
=
(
9A102D1C1CDD257D0026CC43
/* Models Tests */
,
84CA59BA1CD1378100B2A956
/* BUYTestModel.xcdatamodeld */
,
90F592F91B0D5F4C0026B382
/* BUYApplePayAdditionsTest.m */
,
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
,
...
...
@@ -864,7 +867,6 @@
BEB9AE7C1BA8685600575F8A
/* BUYClientTestBase.m */
,
849110341CCE70CE00E53B93
/* BUYDictionaryAdditionsTests.m */
,
849110391CCE718100E53B93
/* BUYExceptionAdditionsTests.m */
,
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
,
8491103D1CCE988600E53B93
/* BUYFontAdditionsTests.m */
,
90F592F81B0D5F4C0026B382
/* BUYIntegrationTest.m */
,
90F592FE1B0D5F4C0026B382
/* BUYLineItemTest.m */
,
...
...
@@ -958,6 +960,15 @@
name
=
"Product View"
;
sourceTree
=
"<group>"
;
};
9A102D1C1CDD257D0026CC43
/* Models Tests */
=
{
isa
=
PBXGroup
;
children
=
(
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
,
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
,
);
name
=
"Models Tests"
;
sourceTree
=
"<group>"
;
};
BE1007981B6165CD0031CEE7
/* Cells */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -1595,6 +1606,7 @@
84CA59BC1CD1378100B2A956
/* BUYTestModel.xcdatamodeld in Sources */
,
9A6B03791CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m in Sources */
,
8491103C1CCE731900E53B93
/* BUYURLAdditionsTests.m in Sources */
,
9A102D1E1CDD25980026CC43
/* BUYOptionValueTests.m in Sources */
,
8491104A1CCEA85C00E53B93
/* BUYObserverTests.m in Sources */
,
84CA59C01CD1609400B2A956
/* TestModel.m in Sources */
,
906CF1AD1B8B5F7D001F7D5B
/* BUYNSPersonNameComponents.m in Sources */
,
...
...
This diff is collapsed.
Click to expand it.
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