コード例 #1
0
        public void DeleteProductCommandCanExecuteWhenProductIsSelected()
        {
            // Fixture setup
            var fixture = new AutoMoqFixture();
            var sut     = fixture.CreateAnonymous <MainWindowViewModel>();

            sut.Products.Add(fixture.Build <ProductViewModel>()
                             .With(x => x.IsSelected, true)
                             .CreateAnonymous());
            // Exercise system
            var result = fixture.Get((object p) => sut.DeleteProductCommand.CanExecute(p));

            // Verify outcome
            Assert.True(result, "DeleteProductCommand");
            // Teardown
        }
コード例 #2
0
 public void DeleteProductCommandCanExecuteWhenProductIsSelected()
 {
     // Fixture setup
     var fixture = new AutoMoqFixture();
     var sut = fixture.CreateAnonymous<MainWindowViewModel>();
     sut.Products.Add(fixture.Build<ProductViewModel>()
         .With(x => x.IsSelected, true)
         .CreateAnonymous());
     // Exercise system
     var result = fixture.Get((object p) => sut.DeleteProductCommand.CanExecute(p));
     // Verify outcome
     Assert.True(result, "DeleteProductCommand");
     // Teardown
 }