コード例 #1
0
        public void EraserDegrades()
        {
            WriterActions writer = new WriterActions();

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

            Assert.AreEqual(1994, writer.pencil.GetCurrentEraserDurability());
        }
コード例 #2
0
        public void EraserDurabilityWhenEmptyStringErased()
        {
            WriterActions writer = new WriterActions();

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

            Assert.AreEqual(2000, writer.pencil.GetCurrentEraserDurability());
        }
コード例 #3
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()));
        }
コード例 #4
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()));
        }
コード例 #5
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()));
        }