вторник, 31 октября 2017 г.

Понятные тесты...

Да, опять тесты...

Вот такие тесты сейчас я нахожу очень понятными (в таком формате я и чужие тесты понимаю, и свои многолетней давности):

    [TestFixture]
    public class RibbonFormTests {
        [Test]
        public void RibbonForm_ControlsAddRibbon_SizeSet700x700_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Controls.Add(new RibbonControl());
                form.Size = new Size(700, 700);
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }



        [Test]
        public void RibbonForm_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_SizeSet700x700_RibbonStatusBarSetVisibleFalse_Show() {
            using(RibbonForm form = new RibbonForm()) {
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Size = new Size(700, 700);
                statusBar.Visible = false;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_SizeSet700x700_Show_RibbonStatusBarSetVisibleFalse() {
            using(RibbonForm form = new RibbonForm()) {
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Size = new Size(700, 700);
                form.Show();
                Application.DoEvents();
                statusBar.Visible = false;
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_SizeSet700x700_Show() {
            using(RibbonForm form = new RibbonForm()) {
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Size = new Size(700, 700);
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_ControlsAddRibbon_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                form.Controls.Add(new RibbonControl());
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_ControlsAddRibbon_RibbonStatusBarSetVisibleFalse_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                form.Controls.Add(new RibbonControl());
                var statusBar = new RibbonStatusBar();
                statusBar.Visible = false;
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_ControlsAddRibbon_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                form.Controls.Add(new RibbonControl());
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_ControlsAddRibbonStatusBar_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_RibbonStatusBarSetVisibleFalse_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                var statusBar = new RibbonStatusBar();
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                statusBar.Visible = false;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_RibbonStatusBarSetVisibleFalse_ControlsAddRibbonStatusBar_StatusBarSetRibbonStatusBar_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                var statusBar = new RibbonStatusBar();
                statusBar.Visible = false;
                form.Controls.Add(statusBar);
                form.StatusBar = statusBar;
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
        [Test]
        public void RibbonForm_SizeSet700x700_Show() {
            using(RibbonForm form = new RibbonForm()) {
                form.Size = new Size(700, 700);
                form.Show();
                Application.DoEvents();
                Assert.AreEqual(700, form.DesktopBounds.Width);
                Assert.AreEqual(700, form.DesktopBounds.Height);
            }
        }
    }

ЗЫ: http://danignatov.blogspot.com/2018/03/blog-post_15.html

Комментариев нет:

Отправить комментарий