Beispiel #1
0
 public HamPhrase(
     IFoodProduct currentFood,
     HamType Ham)
 {
     this.currentFood = currentFood;
     this.Ham         = Ham;
 }
Beispiel #2
0
 public Ham(
     IFoodProduct decoratedInstance,
     int weight,
     HamType hamType) :
     base(decoratedInstance, weight)
 {
     this.hamType = hamType;
 }
        private Ingredients.Ham.Ham GetInstanceUnderTest(int weight, HamType typeOfHam)
        {
            var foodIngrediantMock = new Mock <IFoodProduct>();

            return(new Ingredients.Ham.Ham(
                       foodIngrediantMock.Object,
                       weight,
                       typeOfHam));
        }
        public void GetMyOwnCalories_WeightAndTypeSpecified_EmitsWeightAndTypeRelatedCalories(
            int weight,
            HamType typeOfHam,
            int expectedCalories)
        {
            var instanceUnderTest = this.GetInstanceUnderTest(weight, typeOfHam);

            instanceUnderTest.GetMyOwnCalories().Should().Be(expectedCalories);
        }
Beispiel #5
0
        private int GetPriceForHundredGrammHamType(
            HamType typeOfHam)
        {
            int price = 0;

            switch (typeOfHam)
            {
            case HamType.Pancetta:
                price = 170;
                break;

            case HamType.BlackForest:
                price = 195;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(typeOfHam));
            }
            return(price);
        }
Beispiel #6
0
        private int GetCaloriesOfHundredGrammForHamType(
            HamType typeOfHam)
        {
            int calories = 0;

            switch (typeOfHam)
            {
            case HamType.Pancetta:
                calories = 120;
                break;

            case HamType.BlackForest:
                calories = 143;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(typeOfHam));
            }
            return(calories);
        }
Beispiel #7
0
 public static HamPhrase AddHam(this IFoodProduct instance, HamType typeOfHam)
 {
     return(new HamPhrase(instance, typeOfHam));
 }