예제 #1
0
            public void ShouldNotAllowLengthToBecomeNegative()
            {
                const int startLength    = 0;
                const int expectedLength = 0;
                IPencil   pencil         = GetPencil(length: startLength);

                pencil.Sharpen();

                Assert.Equal(expectedLength, pencil.CurrentLength);
            }
예제 #2
0
            public void ShouldReducePencilLengthByOne()
            {
                const int startLength    = 5;
                const int expectedLength = 4;
                IPencil   pencil         = GetPencil(length: startLength);

                pencil.Sharpen();

                Assert.Equal(expectedLength, pencil.CurrentLength);
            }
예제 #3
0
            public void ShouldSharpenToThePositiveValueForNegativeDurability()
            {
                const int startPointDurability    = -10;
                const int expectedPointDurability = 10;
                IPencil   pencil = GetPencil(pointDurability: startPointDurability);

                pencil.Sharpen();

                Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability);
            }
예제 #4
0
            public void ShouldResetDurabilityToOriginalValue()
            {
                const string testSentence    = "Text to waste pencil durability for testing sharpening abilities";
                const int    pointDurability = 100;
                IPencil      pencil          = GetPencil(pointDurability: pointDurability);

                pencil.Write(GetPaper(), testSentence);
                pencil.Sharpen();

                Assert.Equal(pointDurability, pencil.CurrentPointDurability);
            }
예제 #5
0
            public void ShouldNotResetDurabilityWhenZeroLength()
            {
                const string testSentence            = "Keep it simple";
                const int    length                  = 0;
                const int    startPointDurability    = 100;
                const int    expectedPointDurability = 87;
                IPencil      pencil                  = GetPencil(pointDurability: startPointDurability, length: length);

                pencil.Write(GetPaper(), testSentence);
                pencil.Sharpen();

                Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability);
            }