Exemplo n.º 1
0
        public void HugeCustomShouldWork()
        {
            CustomTacoBox custom = new CustomTacoBox(20000);

            custom.Eat();
            Assert.AreEqual(19999, custom.TacosRemaining(), "Eating from CustomBox should reduce the amount of tacos by one!");
        }
Exemplo n.º 2
0
        public void ZeroCustomEatShouldWork()
        {
            CustomTacoBox custom = new CustomTacoBox(0);

            custom.Eat();
            Assert.AreEqual(0, custom.TacosRemaining(), "Empty CustomBox should not have negative tacos after eating");
        }
Exemplo n.º 3
0
        public void ExampleShouldWork()
        {
            using (StringWriter sw = new StringWriter())
            {
                TextWriter stdout = Console.Out;
                Console.SetOut(sw);
                TripleTacoBox trip = new TripleTacoBox();
                Console.WriteLine(trip.TacosRemaining());
                trip.Eat();
                Console.WriteLine(trip.TacosRemaining());
                trip.Eat();
                Console.WriteLine(trip.TacosRemaining());
                trip.Eat();
                Console.WriteLine(trip.TacosRemaining());
                // Try to eat one too much
                trip.Eat();
                Console.WriteLine(trip.TacosRemaining());

                Console.WriteLine();

                CustomTacoBox custom = new CustomTacoBox(2);
                Console.WriteLine(custom.TacosRemaining());
                custom.Eat();
                Console.WriteLine(custom.TacosRemaining());
                custom.Eat();
                Console.WriteLine(custom.TacosRemaining());
                // Try to eat one too much
                custom.Eat();
                Console.WriteLine(custom.TacosRemaining());
                Console.SetOut(stdout);
                string example = "3\n2\n1\n0\n0\n\n2\n1\n0\n0\n";
                Assert.AreEqual(example, sw.ToString().Replace("\r\n", "\n"), "The example should work as such!");
            }
        }
Exemplo n.º 4
0
        public void HugeCustomEatTooMuchShouldWork()
        {
            CustomTacoBox custom = new CustomTacoBox(20000);

            for (int i = 0; i < 100000; i++)
            {
                custom.Eat();
            }
            Assert.AreEqual(0, custom.TacosRemaining(), "Eating too many from CustomBox should reduce the amount of tacos to zero!");
        }
Exemplo n.º 5
0
        public void ZeroCustomShouldWork()
        {
            CustomTacoBox custom = new CustomTacoBox(0);

            Assert.AreEqual(0, custom.TacosRemaining(), "Empty CustomBox should have zero tacos");
        }