Skip to content

Instantly share code, notes, and snippets.

@deurell
Created June 19, 2010 19:27
Show Gist options
  • Save deurell/445204 to your computer and use it in GitHub Desktop.
Save deurell/445204 to your computer and use it in GitHub Desktop.
// Fire Command
[Test(Description = "Added product shows up in repository with correct savestate")]
public void ExecutingCreateProductCommand_WithNewProduct_ShowsUpInRepository()
{
// Given the user wants to create a new product on the Create Product View
var product = new Product("4242", "desc", ProductType.Assortment, "201001", "123", _dummyArticles, null,
1);
// When the user clicks the New button a CreateProductCommand is fired on the ViewModel
var viewModel = new ProductViewModel(product);
ICommand command = viewModel.CreateProductCommand;
command.Execute(null);
// Then the created product shows up in the Product repository and has savestate set to SaveState.New
Assert.True(Registry.Instance.ProductRepository.LoadedModels.Contains(product));
Assert.That(product.State,Is.EqualTo(SaveState.New));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment