Esempio n. 1
0
        public void BenchmarkPresenter_AddGraphColorClicked_AddsNewColorToGraphColors()
        {
            // Arrange
            var model = CreateModel();

            model.Preferences.Set(Preference.GraphColors, new List <Color>());
            using (var presenter = new MockFormBenchmarksPresenter(model))
            {
                presenter.Show();
                var dialog = new MockColorDialogPresenter(window => DialogResult.OK);
                dialog.Color = Color.FromArgb(72, 134, 186);
                // Act
                presenter.AddGraphColorClicked(dialog);
                // Assert
                Assert.AreEqual(1, model.GraphColors.Count);
                Assert.AreEqual(Color.SteelBlue, model.SelectedGraphColorItem.Value);
            }
        }
Esempio n. 2
0
        public void BenchmarkPresenter_AddGraphColorClicked_ShowsMessageBoxAndDoesNotAddExistingColor()
        {
            // Arrange
            var model = CreateModel();
            var color = Color.AliceBlue;

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

            using (var presenter = new MockFormBenchmarksPresenter(model, messageBox))
            {
                presenter.Show();
                var dialog = new MockColorDialogPresenter(window => DialogResult.OK);
                dialog.Color = color;
                // Act
                presenter.AddGraphColorClicked(dialog);
                // Assert
                Assert.AreEqual(1, model.GraphColors.Count);
                Assert.AreEqual(1, messageBox.Invocations.Count);
            }
        }