Created
January 11, 2012 08:38
-
-
Save JakeGinnivan/1593739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public async Task can_recover_buyback() | |
{ | |
//arrange | |
var buybackId = Guid.NewGuid(); | |
InitialiseViewModel(true, buybackId); | |
_contractService.GetContract(buybackId).Returns(new CustomerBuybackDto { ContractItems = new ObservableCollection<ContractItemDto>() }); | |
_buybackService.RecoverAsync(buybackId).Returns(TaskEx.Run(() => { })); | |
_uiService.AddResult(MessageBoxResult.Yes); | |
//act | |
await _viewModelUnderTest.RecoverCommand.ExecuteAsync(null); | |
//assert | |
_buybackService.Received().RecoverAsync(buybackId); | |
} | |
//This line, I dont want :P | |
_buybackService.RecoverAsync(buybackId).Returns(TaskEx.Run(() => { })); | |
// RecoverAsync returns Task, which is basically the void of the async/await world. | |
// Also have some wcf calls we have moved from IService to IServiceAsync, then it fails because IService automapped the response, Async returns Task<TResponse>, and returns null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment