@@ -14,6 +14,9 @@ namespace Harri.SchoolDemoAPI.BlazorWASM.Tests.Unit.BunitTests
14
14
/// These tests are written entirely in C#.
15
15
/// Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating-basic-tests-in-cs-files
16
16
/// </summary>
17
+
18
+ //TODO update tests for rowVersion
19
+
17
20
[ TestFixture ]
18
21
public class EditStudentFormTests : BunitTestContext
19
22
{
@@ -197,8 +200,8 @@ public async Task EditStudent_ForExistingStudent_SubmitsSuccessfully()
197
200
{
198
201
// Arrange
199
202
var mockExistingStudent = SetUpMockExistingStudent ( ) ;
200
- _mockStudentApiClient . Setup ( client => client . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) ) )
201
- . Returns ( Task . FromResult ( ( bool ? ) true ) ) ;
203
+ _mockStudentApiClient . Setup ( client => client . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) , null ) )
204
+ . Returns ( Task . FromResult ( true ) ) ;
202
205
203
206
var editStudentForm = RenderComponent < EditStudentForm > ( parameters => parameters . Add ( s => s . StudentId , 123 ) ) ;
204
207
@@ -218,18 +221,17 @@ public async Task EditStudent_ForExistingStudent_SubmitsSuccessfully()
218
221
_mockStudentApiClient . Verify (
219
222
x => x . UpdateStudent ( 123 , It . Is < UpdateStudentDto > (
220
223
dto => dto . Name == updatedName &&
221
- dto . GPA == mockExistingStudent . GPA )
224
+ dto . GPA == mockExistingStudent . GPA ) , null
222
225
) , Times . Once ) ;
223
226
}
224
227
225
228
[ TestCase ( false ) ]
226
- [ TestCase ( null ) ]
227
- public async Task EditStudent_ForExistingStudent_ShowsErrorOnFailToUpdate ( bool ? updateStudentResponse )
229
+ public async Task EditStudent_ForExistingStudent_ShowsErrorOnFailToUpdate ( bool updateStudentResponse )
228
230
{
229
231
// Arrange
230
232
var mockExistingStudent = SetUpMockExistingStudent ( ) ;
231
233
232
- _mockStudentApiClient . Setup ( client => client . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) ) )
234
+ _mockStudentApiClient . Setup ( client => client . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) , null ) )
233
235
. Returns ( Task . FromResult ( updateStudentResponse ) ) ;
234
236
235
237
var editStudentForm = RenderComponent < EditStudentForm > ( parameters => parameters . Add ( s => s . StudentId , 123 ) ) ;
@@ -251,7 +253,7 @@ public async Task EditStudent_ForExistingStudent_ShowsErrorOnFailToUpdate(bool?
251
253
_mockStudentApiClient . Verify (
252
254
x => x . UpdateStudent ( 123 , It . Is < UpdateStudentDto > (
253
255
dto => dto . Name == updatedName &&
254
- dto . GPA == mockExistingStudent . GPA )
256
+ dto . GPA == mockExistingStudent . GPA ) , null
255
257
) , Times . Once ) ;
256
258
257
259
var errorAlert = editStudentForm . Find ( ErrorAlertSelector ) ;
@@ -280,7 +282,7 @@ public void EditStudent_ForExistingStudent_DoesNotSubmitWhenNoChangesMade()
280
282
281
283
// Assert
282
284
button . IsDisabled ( ) . Should ( ) . BeTrue ( ) ;
283
- _mockStudentApiClient . Verify ( x => x . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) ) , Times . Never ) ;
285
+ _mockStudentApiClient . Verify ( x => x . UpdateStudent ( It . IsAny < int > ( ) , It . IsAny < UpdateStudentDto > ( ) , null ) , Times . Never ) ;
284
286
}
285
287
286
288
[ Test ]
0 commit comments