public void ExecuteRefreshCommandWillCorrectlyPopulateProducts() { // Fixture setup var fixture = new AutoMoqFixture(); var products = fixture.CreateMany<ProductViewModel>().ToList(); fixture.Freeze<Mock<IProductManagementAgent>>().Setup(a => a.SelectAllProducts()).Returns(products); var sut = fixture.CreateAnonymous<MainWindowViewModel>(); fixture.AddManyTo(sut.Products); // Exercise system fixture.Do((object p) => sut.RefreshCommand.Execute(p)); // Verify outcome Assert.True(products.SequenceEqual(sut.Products), "RefreshCommand"); // Teardown }
public void ExecuteRefreshCommandWillCorrectlyPopulateProducts() { // Fixture setup var fixture = new AutoMoqFixture(); var products = fixture.CreateMany <ProductViewModel>().ToList(); fixture.Freeze <Mock <IProductManagementAgent> >().Setup(a => a.SelectAllProducts()).Returns(products); var sut = fixture.CreateAnonymous <MainWindowViewModel>(); fixture.AddManyTo(sut.Products); // Exercise system fixture.Do((object p) => sut.RefreshCommand.Execute(p)); // Verify outcome Assert.True(products.SequenceEqual(sut.Products), "RefreshCommand"); // Teardown }