public void GetIngredientListReturnsExceptionIfPositionDoesntExists()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var size           = new DTOSize(1, "size1", new Money(1), new DTOPosition(3, "3", "3"));
            var ingredientList = positionList.GetIngredientList(size);
        }
        public void GetSizeListReturnsExceptionIfPositionDoesntExists()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var position = new DTOPosition(3, "3", "3");
            var sizeList = positionList.GetSizeList(position);
        }
        public void LoadPositionList_fillsPositions()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            Assert.AreEqual(2, positionList.Positions.Count);
            Assert.AreEqual(1, positionList.Positions[0].Id);
            Assert.AreEqual(2, positionList.Positions[1].Id);
        }
        public void ConsumablesWork()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var consumables = positionList.Consumables;

            Assert.AreEqual(new DTOConsumable(1, "water", 0), consumables[0]);
        }
        public void DeletePositionDecreasesPositionList()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var position = new DTO.Position(1, "1", "1");

            positionList.DeletePosition(position);
            Assert.AreEqual(1, positionList.Positions.Count);
        }
        public void UpdatePositionWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var position = new DTO.Position(1, "3", "3");

            positionList.UpdatePosition(position);
            Assert.AreEqual("3", positionList.Positions[0].Name);
            Assert.AreEqual("3", positionList.Positions[0].Category);
        }
        public void GetIngredientListWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var size           = new DTOSize(1, "size1", new Money(1), new DTOPosition(1, "1", "1"));
            var ingredientList = positionList.GetIngredientList(size);
            var expected       = new DTOIngredient(1, 1, size, new DTO.Consumable(1, "water", 1));

            Assert.AreEqual(expected, ingredientList[0]);
            Assert.AreEqual(1, ingredientList.Count);
        }
        public void GetSizeListWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var position = new DTO.Position(1, "1", "1");
            var sizeList = positionList.GetSizeList(position);

            Assert.AreEqual(new DTOSize(1, "size1", new Money(1), position), sizeList[0]);
            Assert.AreEqual(new DTOSize(2, "size2", new Money(1), position), sizeList[1]);
            Assert.AreEqual(2, sizeList.Count);
        }
        public void NewSizeInitializesExistedIngredients()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var size = new DTOSize(5, "size5", new Money(1), new DTOPosition(1, "1", "1"));

            positionList.AddSize(size);
            var sizeList = positionList.GetSizeList(size.Position);

            Assert.AreEqual("water", sizeList[2].Ingredients[0].Consumable.Name);
        }
        public void DeleteSizeWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var size = new DTOSize(2, "size2", new Money(1), new DTOPosition(1, "1", "1"));

            positionList.DeleteSize(size);
            var sizeList = positionList.GetSizeList(size.Position);

            Assert.AreEqual(1, sizeList.Count);
        }
        public void UpdateSizeWork()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var size = new DTOSize(2, "size5", new Money(1), new DTOPosition(1, "1", "1"));

            positionList.UpdateSize(size);
            var sizeList = positionList.GetSizeList(size.Position);

            Assert.AreEqual(size, sizeList[1]);
        }
        public void DeleteIngredientWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var ingredient = new DTOIngredient(1, 1, new DTOSize(1, "size1", new Money(1), new DTOPosition(1, "1", "1")),
                                               new DTO.Consumable(1, "water", 1));

            positionList.DeleteIngredient(ingredient);
            var ingredientList = positionList.GetIngredientList(ingredient.Size);

            Assert.AreEqual(0, ingredientList.Count);
        }
        public void UpdateIngredientWorks()
        {
            var positionList = new PositionListDataHolder(new PositionRepositoryStub());

            positionList.LoadPositionList();
            var ingredient1 = new DTOIngredient(5, 1, new DTOSize(1, "size1", new Money(1), new DTOPosition(1, "1", "1")),
                                                new DTO.Consumable(1, "water", 1));

            positionList.AddIngredient(ingredient1);
            var ingredient2 = new DTOIngredient(5, 2, new DTOSize(1, "size1", new Money(1), new DTOPosition(1, "1", "1")),
                                                new DTO.Consumable(1, "water", 1));

            positionList.UpdateIngredient(ingredient2);

            var ingredientList = positionList.GetIngredientList(ingredient2.Size);

            Assert.AreEqual(ingredient2, ingredientList[1]);
        }