@@ -110,6 +110,99 @@ private static void CompareTagGroupsRecursive(DeviceTagGroupCollection? expected
110110 }
111111 }
112112
113+ [ Fact ]
114+ public async Task LoadProject_Full_ShouldLoadCorrectly_BasedOnProductSupport ( )
115+ {
116+ // Arrange
117+ var channel = await AddTestChannel ( ) ;
118+ var device = await AddTestDevice ( channel ) ;
119+ var tags = await AddSimulatorTestTags ( device ) ;
120+ var tagGroup = await AddTestTagGroup ( device ) ;
121+ var tagGroup2 = await AddTestTagGroup ( tagGroup , "TagGroup2" ) ;
122+
123+ var channel2 = await AddTestChannel ( "Channel2" ) ;
124+ var device2 = await AddTestDevice ( channel2 ) ;
125+ var tags2 = await AddSimulatorTestTags ( device2 ) ;
126+ var tagGroup_2 = await AddTestTagGroup ( device2 ) ;
127+ var tagGroup2_2 = await AddTestTagGroup ( tagGroup_2 , "TagGroup2" ) ;
128+
129+ var pro = new Project ( ) ;
130+
131+ // Act
132+ var project = await _kepwareApiClient . Project . LoadProjectAsync ( blnLoadFullProject : true ) ;
133+
134+ // Assert
135+ Assert . NotNull ( project ) ;
136+ Assert . NotNull ( project . Channels ) ;
137+ Assert . Contains ( project . Channels , c => c . Name == channel . Name ) ;
138+
139+ var foundChannel = project . Channels . Find ( c => c . Name == channel . Name ) ;
140+ Assert . NotNull ( foundChannel ) ;
141+ Assert . NotNull ( foundChannel . Devices ) ;
142+ Assert . Contains ( foundChannel . Devices , d => d . Name == device . Name ) ;
143+
144+ var foundDevice = foundChannel . Devices . Find ( d => d . Name == device . Name ) ;
145+ Assert . NotNull ( foundDevice ) ;
146+ Assert . NotNull ( foundDevice . Tags ) ;
147+ Assert . Equal ( tags . Count , foundDevice . Tags . Count ) ;
148+ Assert . NotNull ( foundDevice . TagGroups ) ;
149+ Assert . Contains ( foundDevice . TagGroups , tg => tg . Name == tagGroup . Name ) ;
150+
151+ var foundTagGroup = foundDevice . TagGroups . Find ( tg => tg . Name == tagGroup . Name ) ;
152+ Assert . NotNull ( foundTagGroup ) ;
153+ Assert . NotNull ( foundTagGroup . TagGroups ) ;
154+ Assert . Contains ( foundTagGroup . TagGroups , tg => tg . Name == tagGroup2 . Name ) ;
155+
156+
157+ // Clean up
158+ await DeleteAllChannelsAsync ( ) ;
159+ }
160+
161+ [ Fact ]
162+ public async Task LoadProject_Full_LargeProject_ShouldLoadCorrectly_BasedOnProductSupport ( )
163+ {
164+ // Arrange
165+ var channel = await AddTestChannel ( ) ;
166+ var device = await AddTestDevice ( channel ) ;
167+ var tags = await AddSimulatorTestTags ( device , count : 10000 ) ;
168+ var tagGroup = await AddTestTagGroup ( device ) ;
169+ var tagGroup2 = await AddTestTagGroup ( tagGroup , "TagGroup2" ) ;
170+
171+ var channel2 = await AddTestChannel ( "Channel2" ) ;
172+ var device2 = await AddTestDevice ( channel2 ) ;
173+ var tags2 = await AddSimulatorTestTags ( device2 ) ;
174+ var tagGroup_2 = await AddTestTagGroup ( device2 ) ;
175+ var tagGroup2_2 = await AddTestTagGroup ( tagGroup_2 , "TagGroup2" ) ;
176+
177+ // Act
178+ var project = await _kepwareApiClient . Project . LoadProjectAsync ( blnLoadFullProject : true ) ;
179+
180+ // Assert
181+ Assert . NotNull ( project ) ;
182+ Assert . NotNull ( project . Channels ) ;
183+ Assert . Contains ( project . Channels , c => c . Name == channel . Name ) ;
184+
185+ var foundChannel = project . Channels . Find ( c => c . Name == channel . Name ) ;
186+ Assert . NotNull ( foundChannel ) ;
187+ Assert . NotNull ( foundChannel . Devices ) ;
188+ Assert . Contains ( foundChannel . Devices , d => d . Name == device . Name ) ;
189+
190+ var foundDevice = foundChannel . Devices . Find ( d => d . Name == device . Name ) ;
191+ Assert . NotNull ( foundDevice ) ;
192+ Assert . NotNull ( foundDevice . Tags ) ;
193+ Assert . Equal ( tags . Count , foundDevice . Tags . Count ) ;
194+ Assert . NotNull ( foundDevice . TagGroups ) ;
195+ Assert . Contains ( foundDevice . TagGroups , tg => tg . Name == tagGroup . Name ) ;
196+
197+ var foundTagGroup = foundDevice . TagGroups . Find ( tg => tg . Name == tagGroup . Name ) ;
198+ Assert . NotNull ( foundTagGroup ) ;
199+ Assert . NotNull ( foundTagGroup . TagGroups ) ;
200+ Assert . Contains ( foundTagGroup . TagGroups , tg => tg . Name == tagGroup2 . Name ) ;
201+
202+
203+ // Clean up
204+ await DeleteAllChannelsAsync ( ) ;
205+ }
113206 [ Fact ]
114207 public async Task LoadProject_NotFull_ShouldLoadCorrectly_BasedOnProductSupport ( )
115208 {
@@ -119,7 +212,7 @@ public async Task LoadProject_NotFull_ShouldLoadCorrectly_BasedOnProductSupport(
119212 var tags = await AddSimulatorTestTags ( device ) ;
120213
121214 // Act
122- var project = await _kepwareApiClient . Project . LoadProject ( blnLoadFullProject : false ) ;
215+ var project = await _kepwareApiClient . Project . LoadProjectAsync ( blnLoadFullProject : false ) ;
123216
124217 // Assert
125218 project . ShouldNotBeNull ( ) ;
@@ -139,7 +232,7 @@ public async Task LoadProject_ShouldReturnEmptyProject_WhenHttpRequestFails()
139232 {
140233
141234 // Act
142- var project = await _badCredKepwareApiClient . Project . LoadProject ( true ) ;
235+ var project = await _badCredKepwareApiClient . Project . LoadProjectAsync ( true ) ;
143236
144237 // Assert
145238 project . ShouldNotBeNull ( ) ;
0 commit comments