Commit 96f9886
fix: improve cache invalidation in MockDirectoryInfo (#862)
When invoking the `Create()` and `Delete()` methods on
`MockDirectoryInfo`, the `Exists` property should intrinsically invoke
`Refresh()` the next time it is called. This is necessary to prevent
returning stale state about the directory after those operations.
Additional test cases have been added for `MoveTo()` as well, to ensure
it also not returning stale state.
For context, this change was motivated by PR #828 where similar issues
were solved in `MockFileInfo`.
Co-authored-by: Florian Greinacher <[email protected]>1 parent fc2d041 commit 96f9886
File tree
2 files changed
+76
-1
lines changed- src/System.IO.Abstractions.TestingHelpers
- tests/System.IO.Abstractions.TestingHelpers.Tests
2 files changed
+76
-1
lines changedLines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| 171 | + | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
| |||
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
Lines changed: 72 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
447 | 518 | | |
448 | 519 | | |
449 | 520 | | |
| |||
584 | 655 | | |
585 | 656 | | |
586 | 657 | | |
587 | | - | |
| 658 | + | |
0 commit comments