Esempio n. 1
0
        public void AddingToPaper()
        {
            WriterActions writer         = new WriterActions();
            string        currentInput   = "How";
            string        expectedOutput = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?";

            writer.ProcessInput(currentInput);
            currentInput = " much wood would a woodchuck chuck if a woodchuck could chuck wood?";
            writer.ProcessInput(currentInput);

            Assert.AreEqual(expectedOutput, string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 2
0
        public void PencilDegradationByZero()
        {
            WriterActions writer       = new WriterActions();
            string        currentInput = "shesellsseashells\r\n";

            writer.ProcessInput(currentInput);

            Assert.AreEqual(983, writer.pencil.GetCurrentDurability());
        }
Esempio n. 3
0
        public void PencilDegradationByOne()
        {
            WriterActions writer       = new WriterActions();
            string        currentInput = "she sells sea shells down by the sea shore";

            writer.ProcessInput(currentInput);

            Assert.AreEqual(966, writer.pencil.GetCurrentDurability());
        }
Esempio n. 4
0
        public void CharacterCollision()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("An       a day keeps the doctor away");
            writer.Edit("artichoke");

            Assert.AreEqual("An artich@k@ay keeps the doctor away", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 5
0
        public void EraserDurabilityWhenEmptyStringErased()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("how much wood would.");
            writer.Erase("");

            Assert.AreEqual(2000, writer.pencil.GetCurrentEraserDurability());
        }
Esempio n. 6
0
        public void EditWord()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("An       a day keeps the doctor away");
            writer.Edit("onion");

            Assert.AreEqual("An onion a day keeps the doctor away", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 7
0
        public void EraserDegrades()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("how much wood would.");
            writer.Erase("much w");

            Assert.AreEqual(1994, writer.pencil.GetCurrentEraserDurability());
        }
Esempio n. 8
0
        public void EraseNoText()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("how much wood would.");
            writer.Erase("");

            Assert.AreEqual("how much wood would.", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 9
0
        public void InitialWordWritten()
        {
            WriterActions writer       = new WriterActions();
            string        currentInput = "How";

            writer.ProcessInput(currentInput);

            Assert.AreEqual(currentInput, string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 10
0
        public void PencilLengthUpdated()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("Hello world");
            writer.SharpenPencil();

            Assert.AreEqual(19, writer.pencil.GetLength());
        }
Esempio n. 11
0
        public void WriterSharpensPencil()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("Hello world");
            writer.SharpenPencil();

            Assert.AreEqual(1000, writer.pencil.GetCurrentDurability());
        }
Esempio n. 12
0
        public void EraserDegradesWhileErasing()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("Buffalo Bill");
            writer.pencil.DecreaseEraserDurability(1997); // Degrade eraser to three.
            writer.Erase("Bill");

            Assert.AreEqual("Buffalo B   ", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 13
0
        public void EraseWhenEraserDurabilityZero()
        {
            WriterActions writer = new WriterActions();

            writer.ProcessInput("how much wood would.");
            writer.pencil.DecreaseEraserDurability(2000); // Degrade eraser to zero.
            writer.Erase("how ");

            Assert.AreEqual("how much wood would.", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 14
0
        public void SpacesWhenLengthIsZero()
        {
            WriterActions writer = new WriterActions();

            writer.pencil.SetLength(1);
            writer.pencil.SetDurability(0);
            writer.SharpenPencil();
            writer.ProcessInput("Hello world");

            Assert.AreEqual("           ", string.Join(null, writer.paper.ToArray()));
        }
Esempio n. 15
0
        public void PrintsWhiteSpaceWhenDull()
        {
            WriterActions writer         = new WriterActions();
            string        currentInput   = "How much wood would";
            string        expectedOutput = "How much wood w    ";

            writer.pencil.SetDurability(13);
            writer.ProcessInput(currentInput);

            Assert.AreEqual(expectedOutput, String.Join(null, writer.paper.ToArray()));
        }