コード例 #1
0
 public void WhenFontFamilyIsWrong_ThenNextSmallerFontThrowsArgumentException()
 {
     using (var font = new Font(FontFamily.GenericSerif, 10f, FontStyle.Regular))
     {
         Assert.Throws <ArgumentException>(
             () => TerminalFont.NextSmallerFont(font));
     }
 }
コード例 #2
0
 public void WhenFontFamilyIsOk_ThenNextSmallerFontThrowsArgumentException()
 {
     using (var font = new Font(TerminalFont.FontFamily, 10f, FontStyle.Regular))
     {
         using (var smallerFont = TerminalFont.NextSmallerFont(font))
         {
             Assert.AreEqual(smallerFont.Size, font.Size - 1);
         }
     }
 }
コード例 #3
0
 public void NextSmallerFontReturnsSmallerFont()
 {
     using (var font = new TerminalFont(TerminalFont.DefaultFontFamily, 10f))
     {
         using (var smallerFont = font.NextSmallerFont())
         {
             Assert.AreEqual(font.Font.Size - 1, smallerFont.Font.Size);
         }
     }
 }
コード例 #4
0
        public void WhenMinSizeReached_NextSmallerFontKeepsSize()
        {
            var font = new TerminalFont(TerminalFont.DefaultFontFamily, 10f);

            for (int i = 0; i < 10; i++)
            {
                font = font.NextSmallerFont();
            }

            Assert.AreEqual(TerminalFont.MinimumSize, font.Font.Size);
        }