Created
April 5, 2013 13:45
-
-
Save laurentkempe/5319365 to your computer and use it in GitHub Desktop.
Fluent interface to test MVVMLight Messenger
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
[Test, RequiresSTA] | |
public void DeleteBrickCommand_BrickSelected_ExpectEnableMainWindowMessageSentWithFalseThenTrue() | |
{ | |
//Arrange | |
var productViewModel = makeProductViewModel(); | |
var brick = productViewModel.AddBrick(); | |
var rootGraphSourceViewModel = new RootGraphSourceViewModel(); | |
rootGraphSourceViewModel.Initialize(productViewModel); | |
rootGraphSourceViewModel.Show(); | |
brick.IsSelected = true; | |
//Act | |
//Assert | |
rootGraphSourceViewModel.Expect() | |
.SendingMessages<EnableMainWindowMessage, bool>(new [] { false, true }) | |
.When(model => model.DeleteBrickCommand.Execute(null)); | |
} |
Have you considered extending FluentAssertions (http://fluentassertions.codeplex.com/) for that? And something similar was done for MVC in another project (https://fluentassertionsmvc.codeplex.com/).
@dennisdoomen Thanks! No I haven't at the moment, but this is also why I posted that, to get some idea!
btw the MVC project is not really relevant as I target MVVMLight so WPF, Silverlight and Win8 Metro and Windows Phone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testing that the message EnableMainWindowMessage with the value false is sent then with the value true when the DeleteBrickCommand is executed.