public async Task LoadChildren_UpdatesAllSpaces() { var initialSpacesList = new System.Collections.ObjectModel.ObservableCollection <TreeViewItemViewModel> { new SpaceViewModel(new CloudFoundrySpace("initial space 1", "initial space 1 guid", null), null, null, Services), new SpaceViewModel(new CloudFoundrySpace("initial space 2", "initial space 2 guid", null), null, null, Services), new SpaceViewModel(new CloudFoundrySpace("initial space 3", "initial space 3 guid", null), null, null, Services), }; var newSpacesList = new List <CloudFoundrySpace> { new CloudFoundrySpace("initial space 1", "initial space 1 guid", null), new CloudFoundrySpace("initial space 2", "initial space 2 guid", null), }; var fakeSucccessResponse = new DetailedResult <List <CloudFoundrySpace> >( content: newSpacesList, succeeded: true, explanation: null, cmdDetails: FakeSuccessCmdResult); _sut.Children = initialSpacesList; /* erase record of initial "Children" event */ _receivedEvents.Clear(); MockCloudFoundryService.Setup(mock => mock. GetSpacesForOrgAsync(It.IsAny <CloudFoundryOrganization>(), true, It.IsAny <int>())) .ReturnsAsync(fakeSucccessResponse); Assert.AreEqual(initialSpacesList.Count, _sut.Children.Count); await _sut.LoadChildren(); Assert.AreEqual(newSpacesList.Count, _sut.Children.Count); foreach (TreeViewItemViewModel child in _sut.Children) { Assert.AreEqual(_sut, child.Parent); } Assert.AreEqual(1, _receivedEvents.Count); Assert.AreEqual("Children", _receivedEvents[0]); Assert.IsFalse(_sut.HasEmptyPlaceholder); }