@@ -33,23 +33,59 @@ private static AppStoreServerApiClient GetAppStoreServerApiClient(MockHttpMessag
3333 [ Fact ]
3434 public async Task GetAllSubscriptionStatuses_Success ( )
3535 {
36+ const string responseData = """
37+ {
38+ "environment" : "Sandbox",
39+ "bundleId" : "com.test.app",
40+ "appAppleId" : 1234567890,
41+ "data" : [ {
42+ "subscriptionGroupIdentifier" : "98765",
43+ "lastTransactions" : [ {
44+ "originalTransactionId" : "123454321",
45+ "status" : 2,
46+ "signedTransactionInfo" : "eyabc",
47+ "signedRenewalInfo" : "eyxyz"
48+ } ]
49+ } ]
50+ }
51+ """ ;
3652 var mockHttp = new MockHttpMessageHandler ( ) ;
3753 mockHttp
38- . When ( $ " { AppStoreEnvironment . LocalTesting . BaseUrl } v1/subscriptions/123456")
39- . Respond ( "application/json" , "{ \" data \" :[]}" ) ;
54+ . When ( "https://local-testing-base-url/inApps/ v1/subscriptions/123456")
55+ . Respond ( "application/json" , responseData ) ;
4056
4157 AppStoreServerApiClient client = GetAppStoreServerApiClient ( mockHttp ) ;
4258 SubscriptionStatusResponse response = await client . GetAllSubscriptionStatuses ( "123456" ) ;
4359
4460 Assert . NotNull ( response ) ;
61+ Assert . Equal ( "Sandbox" , response . Environment ) ;
62+ Assert . Equal ( "com.test.app" , response . BundleId ) ;
63+ Assert . Equal ( 1234567890 , response . AppAppleId ) ;
64+ Assert . Collection (
65+ response . Data ,
66+ data =>
67+ {
68+ Assert . Equal ( "98765" , data . SubscriptionGroupIdentifier ) ;
69+ Assert . Collection (
70+ data . LastTransactions ,
71+ transaction =>
72+ {
73+ Assert . Equal ( "123454321" , transaction . OriginalTransactionId ) ;
74+ Assert . Equal ( TransactionsItemSubscriptionStatus . Expired , transaction . Status ) ;
75+ Assert . Equal ( "eyabc" , transaction . SignedTransactionInfo ) ;
76+ Assert . Equal ( "eyxyz" , transaction . SignedRenewalInfo ) ;
77+ }
78+ ) ;
79+ }
80+ ) ;
4581 }
4682
4783 [ Fact ]
4884 public async Task GetNotificationHistory_Success ( )
4985 {
5086 var mockHttp = new MockHttpMessageHandler ( ) ;
5187 mockHttp
52- . When ( $ "{ AppStoreEnvironment . LocalTesting . BaseUrl } v1/notifications/history")
88+ . When ( $ "https://local-testing-base-url/inApps/ v1/notifications/history")
5389 . Respond ( "application/json" , "{\" notificationHistory\" :[]}" ) ;
5490
5591 AppStoreServerApiClient client = GetAppStoreServerApiClient ( mockHttp ) ;
@@ -63,7 +99,7 @@ public async Task GetTransactionHistory_Success()
6399 {
64100 var mockHttp = new MockHttpMessageHandler ( ) ;
65101 mockHttp
66- . When ( $ "{ AppStoreEnvironment . LocalTesting . BaseUrl } v2/history/123456")
102+ . When ( $ "https://local-testing-base-url/inApps/ v2/history/123456")
67103 . Respond ( "application/json" , "{\" signedTransactions\" :[]}" ) ;
68104
69105 AppStoreServerApiClient client = GetAppStoreServerApiClient ( mockHttp ) ;
@@ -77,7 +113,7 @@ public async Task SendConsumptionData_Success()
77113 {
78114 var mockHttp = new MockHttpMessageHandler ( ) ;
79115 mockHttp
80- . When ( $ "{ AppStoreEnvironment . LocalTesting . BaseUrl } v1/transactions/consumption/123456")
116+ . When ( $ "https://local-testing-base-url/inApps/ v1/transactions/consumption/123456")
81117 . Respond ( System . Net . HttpStatusCode . OK ) ;
82118
83119 AppStoreServerApiClient client = GetAppStoreServerApiClient ( mockHttp ) ;
0 commit comments