Exemplo n.º 1
0
        public void BenchmarkPresenter_DeleteGraphColorClicked_DeletesColor()
        {
            // Arrange
            var model  = CreateModel();
            var color0 = Color.AliceBlue;
            var color1 = Color.SaddleBrown;
            var color2 = Color.Yellow;
            var color3 = Color.Red;

            model.Preferences.Set(Preference.GraphColors, new List <Color> {
                color0, color1, color2, color3
            });
            var messageBox = new MockMessageBoxPresenter((o, t, c) => DialogResult.Yes);

            using (var presenter = new MockFormBenchmarksPresenter(model, messageBox))
            {
                presenter.Show();
                Assert.AreEqual(4, presenter.Model.GraphColors.Count);
                // Act
                presenter.DeleteGraphColorClicked();
                // Assert
                Assert.AreEqual(3, presenter.Model.GraphColors.Count);
                Assert.AreEqual(0, messageBox.Invocations.Count);
            }
        }
Exemplo n.º 2
0
        public void BenchmarkPresenter_DeleteGraphColorClicked_ShowsMessageBoxWhenSelectedGraphColorItemIsNull()
        {
            // Arrange
            var model = CreateModel();

            model.Preferences.Set(Preference.GraphColors, new List <Color>());
            var messageBox = new MockMessageBoxPresenter((o, t, c) => DialogResult.Yes);

            using (var presenter = new MockFormBenchmarksPresenter(model, messageBox))
            {
                presenter.Show();
                Assert.IsNull(presenter.Model.SelectedGraphColorItem);
                // Act
                presenter.DeleteGraphColorClicked();
                // Assert
                Assert.AreEqual(1, messageBox.Invocations.Count);
            }
        }