File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Net . Http ;
5+ using System . Text ;
6+ using System . Threading . Tasks ;
7+ using RestSharp ;
8+
9+ namespace Greg . Requests
10+ {
11+ /// <summary>
12+ /// Returns the compatibility information with a fixed map of host applications
13+ /// and it's respective supported Dynamo version
14+ /// </summary>
15+ public class GetCompatibilityMap : Request
16+ {
17+ public GetCompatibilityMap ( )
18+ {
19+ }
20+
21+ public override string Path
22+ {
23+ get { return "host_map" ; }
24+ }
25+
26+ public override HttpMethod HttpMethod
27+ {
28+ get { return HttpMethod . Get ; }
29+ }
30+
31+ internal override void Build ( ref RestRequest request )
32+ {
33+ }
34+ }
35+ }
Original file line number Diff line number Diff line change 22using Greg . Requests ;
33using Greg . Responses ;
44using Greg . Utility ;
5+ using Newtonsoft . Json . Linq ;
56using RestSharp ;
67using System . Reflection ;
78using System . Text . Json ;
@@ -161,6 +162,19 @@ public void ListHostsTest()
161162 Assert . That ( hostsResponse . content . Count , Is . EqualTo ( 5 ) ) ;
162163 }
163164
165+ [ Test ]
166+ public void ListCompatibilityMapTest ( )
167+ {
168+ GregClient pmc = new GregClient ( null , "http://dynamopackages.com/" ) ;
169+ var comMap = new GetCompatibilityMap ( ) ;
170+ var comMapResponse = pmc . ExecuteAndDeserializeWithContent < object > ( comMap ) ;
171+ Assert . That ( comMapResponse . content != null , Is . EqualTo ( true ) ) ;
172+ var content = JsonSerializer . Serialize ( comMapResponse . content ) ;
173+ Console . WriteLine ( content ) ;
174+ var jsonResp = JArray . Parse ( content ) ;
175+ Assert . That ( jsonResp . Where ( x => ( ( JObject ) x ) . ContainsKey ( "Revit" ) || ( ( JObject ) x ) . ContainsKey ( "Civil3D" ) ) . Any ( ) , Is . EqualTo ( true ) ) ;
176+ }
177+
164178 [ Test ]
165179
166180 public void TestCompatibilityDeserializationTest ( )
You can’t perform that action at this time.
0 commit comments