Example #1
0
        public void Two_People_Two_Pizzas()
        {
            var subject = new PizzaSplitter();

            var split = subject.Split(numberOfPizzas: 2, numberOfPeople: 2);

            Assert.That(split.SlicesPerPerson, Is.EqualTo(2));
            Assert.That(split.LeftOverSlices, Is.EqualTo(0));
        }
        public void Eight_People_Two_Pizzas()
        {
            var subject = new PizzaSplitter();

            var split = subject.Split(numberOfPizzas:2, numberOfPeople:8);
            
            Assert.That(split.SlicesPerPerson, Is.EqualTo(2));
            Assert.That(split.LeftOverSlices, Is.EqualTo(0));
        }
Example #3
0
        public void Execute()
        {
            int numberOfPeople = Input.Parse(message: "How many people? ");
            int numberOfPizzas = Input.Parse(message: "How many pizzas do you have? ");

            Console.WriteLine("{0} people with {1} pizzas.", numberOfPeople, numberOfPizzas);

            var pizzaSplitter = new PizzaSplitter();
            var pizzaSlices   = pizzaSplitter.Split(numberOfPizzas, numberOfPeople);

            Console.WriteLine("Each person gets {0} pieces of pizza.", pizzaSlices.SlicesPerPerson);
            Console.WriteLine("There are {0} leftover pieces.", pizzaSlices.LeftOverSlices);
        }
        public void Execute()
        {
            int numberOfPeople = Input.Parse(message: "How many people? ");
            int numberOfPizzas = Input.Parse(message: "How many pizzas do you have? ");

            Console.WriteLine("{0} people with {1} pizzas.", numberOfPeople, numberOfPizzas);

            var pizzaSplitter = new PizzaSplitter();
            var pizzaSlices = pizzaSplitter.Split(numberOfPizzas, numberOfPeople);

            Console.WriteLine("Each person gets {0} pieces of pizza.", pizzaSlices.SlicesPerPerson);
            Console.WriteLine("There are {0} leftover pieces.", pizzaSlices.LeftOverSlices);
        }