public async void ImportAsync_ShouldComplementExistingLocation() { // Arrange SetUp(); _locationServiceProxy.GetAllLocationsAsync() .Returns(_ => { var tcs = new TaskCompletionSource <IEnumerable <Location> >(); tcs.SetResult(new List <Location> { _locationToImport }); return(tcs.Task); }); _snapshotServiceProxy.GetSnapshotsByLocationIdAsync(Arg.Any <int>()) .Returns(_ => { var tcs = new TaskCompletionSource <IEnumerable <LocationSnapshot> >(); tcs.SetResult(new List <LocationSnapshot> { _snapshotsToImport[0] }); return(tcs.Task); }); // Act var sit = new LocationDataImporter(_dataServiceFactory); await sit.ImportAsync(new List <Location> { _locationToImport }, new CancellationTokenSource().Token); // Assert await _locationServiceProxy.DidNotReceive().AddLocationAsync(_locationToImport); await _snapshotServiceProxy.DidNotReceive().AddSnapshotAsync(_snapshotsToImport[0]); await _snapshotServiceProxy.Received().AddSnapshotAsync(_snapshotsToImport[1]); await _pictureServiceProxy.DidNotReceive().SaveSnapshotContentAsync(_snapshotsToImport[0], _pictureData); await _pictureServiceProxy.Received().SaveSnapshotContentAsync(_snapshotsToImport[1], _pictureData); }