public void ExceptionIsNotThrownIfParameterIsNotNumericUpDown()
        {
            // Arrange

            var command = new DecrementNumericUpDownValue();

            // Assert

            Assert.DoesNotThrow(() => command.Execute(new object()));
        }
        public void CanExecuteReturnsTrue()
        {
            // Arrange

            var command = new DecrementNumericUpDownValue();

            // Act

            var canExecute = command.CanExecute(null);

            // Assert

            Assert.IsTrue(canExecute);
        }
        public void NumericUpDownValueIsNotDecrementedBeyondMinimum()
        {
            // Arrange

            var controlMock = new Mock <IIntValueControl>();

            controlMock.Setup(c => c.Minimum).Returns(1);

            var command = new DecrementNumericUpDownValue();

            // Act

            command.Execute(controlMock.Object);

            // Assert

            controlMock.VerifySet(c => c.Value--, Times.Never);
        }
        public void CommandDecrementsNumericUpDownValue()
        {
            // Arrange

            var upDown = new NumericUpDown
            {
                Minimum = 0,
                Value   = 5
            };

            var command = new DecrementNumericUpDownValue();

            // Act

            command.Execute(upDown);

            // Assert

            Assert.That(upDown.Value, Is.EqualTo(4));
        }
Ejemplo n.º 5
0
        public void NumericUpDownValueIsNotDecrementedBeyondMinimum(
            int minimum,
            int value,
            int expected)
        {
            // Arrange

            var control = new TestingValueControl
            {
                Minimum = minimum,
                Value   = value
            };

            var command = new DecrementNumericUpDownValue();

            // Act

            command.Execute(control);

            // Assert

            Assert.AreEqual(expected, control.Value);
        }