Skip to content

Instantly share code, notes, and snippets.

@deurell
Created June 19, 2010 19:27
Show Gist options
  • Save deurell/445205 to your computer and use it in GitHub Desktop.
Save deurell/445205 to your computer and use it in GitHub Desktop.
// Fire command and validate mediator
[Test(Description = "Executing DisplayArticlesViewCommand sends message with products articles [Mikael Deurell]")]
public void Executing_DisplayArticlesViewCommand_SendsDisplayArticleViewListWithProvidedArticles()
{
// Given the user wants to display selected articles in a dialogue view
var sut =
new ProductViewModel(new Product("1", "desc", ProductType.Assortment, "10", "10", _dummyArticles, null,
0));
int notify = 0;
ObservableCollection<ArticleViewModel> articlesReceived = null;
Messenger.Instance.Register(MessageType.DisplayArticleViewList,
(ObservableCollection<ArticleViewModel> articles) =>
{
articlesReceived = articles;
++notify;
});
// When the user clicks button and trigger the execution of a DisplayArticleViewDialogueCommand
ICommand command = sut.DisplayArticleViewDialogueCommand;
command.Execute(null);
// Then the selected articles received to be displayed by the viewmodel are the same as the articles sent to the mediator
Assert.That(articlesReceived, Is.EqualTo(sut.Articles));
Assert.That(notify, Is.EqualTo(1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment