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 AddPositionWorks() { var facade = new PositionListFacade(new PositionListStub(), new SizeListStub(), new IngredientListStub()); var position = new Position(1, "1", "1"); var list = facade.AddPosition(position); Assert.AreEqual(position, list[0]); }
public void DeletePositionWorks() { var facade = new PositionListFacade(new PositionListStub(), new SizeListStub(), new IngredientListStub()); var position = new Position(1, "1", "1"); facade.AddPosition(position); var list = facade.DeletePosition(position); Assert.AreEqual(0, list.Count); }