public void ShouldRewriteAccountsInStoreWhenNewAccountAdded() { var accountToSave = new WotBlitzStatician.Model.AccountInfo { AccountId = 42, NickName = "Yeah" }; Assert.Empty(_accountsSearchHistoryViewModel.Accounts); _accountsSearchHistoryViewModel.ListenTo(new ShowFoundAccountInfoMessage(accountToSave)); _searchHistoryDataAdapterMock.Verify( d => d.RewriteAccountsHistory(It.IsAny <List <WotBlitzStatician.Model.AccountInfo> >()), Times.Once); }
public void ShouldAddAccountToListWhenOlListenMessageFiredOnlyDistinctAccounts() { var newAccount = new WotBlitzStatician.Model.AccountInfo { AccountId = 42, NickName = "Yeah" }; Assert.Empty(_accountsSearchHistoryViewModel.Accounts); _accountsSearchHistoryViewModel.ListenTo(new ShowFoundAccountInfoMessage(newAccount)); _accountsSearchHistoryViewModel.ListenTo(new ShowFoundAccountInfoMessage(newAccount)); Assert.NotEmpty(_accountsSearchHistoryViewModel.Accounts); Assert.Single(_accountsSearchHistoryViewModel.Accounts); }
public void ShouldAddAccountToListWhenOlListenMessageFired() { var newAccount = new WotBlitzStatician.Model.AccountInfo { AccountId = 42, NickName = "Yeah" }; Assert.Empty(_accountsSearchHistoryViewModel.Accounts); _accountsSearchHistoryViewModel.ListenTo(new ShowFoundAccountInfoMessage(newAccount)); Assert.NotEmpty(_accountsSearchHistoryViewModel.Accounts); Assert.Collection(_accountsSearchHistoryViewModel.Accounts, (item) => { Assert.Equal(newAccount.AccountId, item.AccountId); Assert.Equal(newAccount.NickName, item.NickName); }); }
public void ShouldFireEventWhenAccountSelected() { var accountInfo = new WotBlitzStatician.Model.AccountInfo { AccountId = 42, NickName = "Yeah" }; long accountIdFromMessage = 0; _applicationMessageDicpatcherMock.Setup(m => m.Publish(It.IsAny <ShowHistoricalAccountInfoMessage>())) .Callback <ShowHistoricalAccountInfoMessage>(message => accountIdFromMessage = message.AccountInfo.AccountId); _accountsSearchHistoryViewModel.Accounts = new ObservableCollection <WotBlitzStatician.Model.AccountInfo> { new WotBlitzStatician.Model.AccountInfo(), accountInfo }; _accountsSearchHistoryViewModel.SelectedAccount = accountInfo; _applicationMessageDicpatcherMock.Verify(m => m.Publish(It.IsAny <ShowHistoricalAccountInfoMessage>()), Times.Once); Assert.Equal(accountInfo.AccountId, accountIdFromMessage); }
public ShowHistoricalAccountInfoMessage(WotBlitzStatician.Model.AccountInfo accountInfo) { AccountInfo = accountInfo; }
public ShowFoundAccountInfoMessage(WotBlitzStatician.Model.AccountInfo accountInfo) { AccountInfo = accountInfo; }
public AccountInfoDto Map(WotBlitzStatician.Model.AccountInfo accountInfo) { return(_mapper.Map <AccountInfoDto>(accountInfo)); }