public CreateSwagDialog(CreateSwagViewModel viewModel) { _viewModel = viewModel; _viewModel.ThingGood += RespondToSwagGood; DataContext = _viewModel; InitializeComponent(); }
public void CreateSwagViewModelShouldConstructAnInvalidSwagWhenGivenMissingInput() { // Arrange var SwagValid = false; // Act var viewModel = new CreateSwagViewModel(); viewModel.ThingGood += (o, e) => SwagValid = e.IsGood; viewModel.Thing = "Thing"; viewModel.CreateCommand.Execute(null); // Assert Assert.IsFalse(SwagValid); Assert.IsNull(viewModel.NewThing); }
public void CreateSwagViewModelShouldConstructAnInvalidSwagWhenGivenMissingInput() { // Arrange var swagValid = false; // Act var viewModel = new CreateSwagViewModel(); viewModel.ThingGood += (o, e) => swagValid = e.IsGood; viewModel.Thing = "Thing"; viewModel.CreateCommand.Execute(null); // Assert Assert.IsFalse(swagValid); Assert.IsNull(viewModel.NewThing); }
public void CreateSwagViewModelShouldConstructValidSwagWhenGivenGoodInput() { // Arrange var SwagValid = false; // Act var viewModel = new CreateSwagViewModel(); viewModel.ThingGood += (o, e) => SwagValid = e.IsGood; viewModel.Thing = "Thing"; viewModel.Company = "Company"; viewModel.CreateCommand.Execute(null); // Assert Assert.IsTrue(SwagValid); Assert.AreEqual(viewModel.NewThing.Thing, "Thing"); Assert.AreEqual(viewModel.NewThing.Company, "Company"); }
public void CreateSwagViewModelShouldConstructValidSwagWhenGivenGoodInput() { // Arrange var swagValid = false; // Act var viewModel = new CreateSwagViewModel(); viewModel.ThingGood += (o, e) => swagValid = e.IsGood; viewModel.Thing = "Thing"; viewModel.Company = "Company"; viewModel.CreateCommand.Execute(null); // Assert Assert.IsTrue(swagValid); Assert.AreEqual(viewModel.NewThing.Thing, "Thing"); Assert.AreEqual(viewModel.NewThing.Company, "Company"); }
public ICreateNewThings <SwagBase> CreateDialog() { var viewModel = new CreateSwagViewModel(); return(new CreateSwagDialog(viewModel)); }