File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,10 +23,27 @@ public async Task TasksPopulation_IsIdempotent()
2323 sut . Tasks . Should ( ) . BeEquivalentTo ( await taskRepository . All ( ) ) ;
2424 }
2525
26- private static TaskListViewModel TaskListViewModel ( InMemoryTaskRepository taskRepository )
26+ [ Test ]
27+ public void
28+ TasksPopulation_DoesNotShowDuplicatedTasks_BetweenBackendAndFileSystemRepositories ( )
29+ {
30+ var duplicatedTask = DesktopTask ( ) ;
31+ var backendRepository = new InMemoryTaskRepository ( [ duplicatedTask ] ) ;
32+ var fileSystemRepository = new InMemoryTaskRepository ( [ duplicatedTask ] ) ;
33+ var sut = TaskListViewModel (
34+ backendRepository ,
35+ fileSystemRepository ) ;
36+
37+ sut . PopulateTasks ( ) ;
38+
39+ sut . Tasks . Should ( ) . ContainSingle ( ) ;
40+ }
41+
42+ private static TaskListViewModel TaskListViewModel (
43+ params InMemoryTaskRepository [ ] taskRepositories )
2744 {
2845 return new TaskListViewModel (
29- [ taskRepository ] ,
30- new TaskCreationViewModel ( [ taskRepository ] ) ) ;
46+ taskRepositories ,
47+ new TaskCreationViewModel ( taskRepositories ) ) ;
3148 }
3249}
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public void PopulateTasks()
5353 . WhenAll ( taskRepositories . Select ( x => x . All ( ) ) ) )
5454 . Result
5555 . SelectMany ( x => x ) ;
56- foreach ( var task in retrievedTasks )
56+ foreach ( var task in retrievedTasks . Distinct ( ) )
5757 Tasks . Add ( task ) ;
5858 }
5959}
You can’t perform that action at this time.
0 commit comments