blob: dbada5f4e82cc7429552c2ff9797f05d32b731c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// SDLOasisAddressSpec.m
//
#import <Foundation/Foundation.h>
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
#import "SDLOasisAddress.h"
#import "SDLRPCParameterNames.h"
QuickSpecBegin(SDLOasisAddressSpec)
describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] init];
testStruct.countryName = @"United States";
testStruct.countryCode = @"US";
testStruct.postalCode = @"123456";
testStruct.administrativeArea = @"CA";
testStruct.subAdministrativeArea = @"Santa Clara";
testStruct.locality = @"Palo Alto";
testStruct.subLocality = @"18";
testStruct.thoroughfare = @"Candy Lane";
testStruct.subThoroughfare = @"123";
expect(testStruct.countryName).to(equal(@"United States"));
expect(testStruct.countryCode).to(equal(@"US"));
expect(testStruct.postalCode).to(equal(@"123456"));
expect(testStruct.administrativeArea).to(equal(@"CA"));
expect(testStruct.subAdministrativeArea).to(equal(@"Santa Clara"));
expect(testStruct.locality).to(equal(@"Palo Alto"));
expect(testStruct.subLocality).to(equal(@"18"));
expect(testStruct.thoroughfare).to(equal(@"Candy Lane"));
expect(testStruct.subThoroughfare).to(equal(@"123"));
});
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLRPCParameterNameCountryName:@"United States",
SDLRPCParameterNameCountryCode:@"US",
SDLRPCParameterNamePostalCode:@"123456",
SDLRPCParameterNameAdministrativeArea:@"CA",
SDLRPCParameterNameSubAdministrativeArea:@"Santa Clara",
SDLRPCParameterNameLocality:@"Palo Alto",
SDLRPCParameterNameSubLocality:@"18",
SDLRPCParameterNameThoroughfare:@"Candy Lane",
SDLRPCParameterNameSubThoroughfare:@"123"} mutableCopy];
SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] initWithDictionary:dict];
expect(testStruct.countryName).to(equal(@"United States"));
expect(testStruct.countryCode).to(equal(@"US"));
expect(testStruct.postalCode).to(equal(@"123456"));
expect(testStruct.administrativeArea).to(equal(@"CA"));
expect(testStruct.subAdministrativeArea).to(equal(@"Santa Clara"));
expect(testStruct.locality).to(equal(@"Palo Alto"));
expect(testStruct.subLocality).to(equal(@"18"));
expect(testStruct.thoroughfare).to(equal(@"Candy Lane"));
expect(testStruct.subThoroughfare).to(equal(@"123"));
});
it(@"Should return nil if not set", ^ {
SDLOasisAddress* testStruct = [[SDLOasisAddress alloc] init];
expect(testStruct.countryName).to(beNil());
expect(testStruct.countryCode).to(beNil());
expect(testStruct.postalCode).to(beNil());
expect(testStruct.administrativeArea).to(beNil());
expect(testStruct.subAdministrativeArea).to(beNil());
expect(testStruct.locality).to(beNil());
expect(testStruct.subLocality).to(beNil());
expect(testStruct.thoroughfare).to(beNil());
expect(testStruct.subThoroughfare).to(beNil());
});
});
QuickSpecEnd
|