public void IngredientsUpdates_Works() { var dataHolder = new PositionListDataHolder(new PositionRepositoryEFStub()); var facade = new PositionListFacade(new PositionListValidator(new PositionListFeedback(dataHolder)), new SizeListValidator(new SizeListFeedback(dataHolder)), new IngredientListValidator(new IngredientListFeedback(dataHolder))); var viewModel = new PositionListViewModelStub(facade); var position = new Position(1, "1", "1"); var positions = facade.AddPosition(position); viewModel.SelectedPosition = positions[0]; var size = new Size(0, "1", new Money(1), viewModel.SelectedPosition); facade.AddSize(size); var consumable = new Consumable(1, "1", 0); viewModel.DataGridController.AddRow(consumable); Assert.IsNotNull(viewModel.SelectedPosition); var row = viewModel.DataGridController.IngredientRows.ToList()[0]; row.Columns["1"] = 1.0; row.EndEdit(); Assert.AreEqual(1, dataHolder.GetIngredientList(dataHolder.GetSizeList(viewModel.SelectedPosition)[0])[0].Amount); }
public void AddSizeWorks() { var facade = new PositionListFacade(new PositionListStub(), new SizeListStub(), new IngredientListStub()); var size = new Size(1, "1", new Money(1), new Position(1, "1", "1")); var list = facade.AddSize(size); Assert.AreEqual(size, list[0]); }