public void BiggerNumberCorrectInput(int value, int minValue, bool awaitedResult) { //arrange minValueValidator = new MinValueValidator(minValue); //act var result = minValueValidator.Validate(value); //assert Assert.AreEqual(result, awaitedResult); }
public void ShouldBeInvalidIfValueBelowMin(IComparable value, IComparable min) { // Arrange var validator = new MinValueValidator(min); // Act validator.Validate(value); // Assert validator.IsInvalid.ShouldBe(true); }
public void ShouldBeDirtyOnceValidated() { // Arrange int value = 1; var validator = new MinValueValidator(0); // Act validator.Validate(value); // Assert validator.IsDirty.ShouldBe(true); }
public override void SetMinMaxValue() { var consolInput = new ControlService(); Console.Clear(); View.Print("Player 1 pleas enter min value of the range: "); gameResources.MinValue = consolInput.ReadIntFromConsole(); View.Print("Player 1 pleas enter max value of the range: "); var minValueValidator = new MinValueValidator(gameResources.MinValue); gameResources.MaxValue = consolInput.ReadIntFromConsole(minValueValidator); }
public void WhenParameterIsLessThanMinValue_ThrowsException() { try { var temp = 3; var nullValidator = new MinValueValidator<int>(() => temp, 4); nullValidator.Validate(); } catch (ArgumentOutOfRangeException argumentOutOfRangeException) { Assert.AreEqual("temp", argumentOutOfRangeException.ParamName); throw; } }
public void WhenParameterIsGreaterThanMinValue_DoesNotThrowException() { var temp = 3; var nullValidator = new MinValueValidator<int>(() => temp, 2); nullValidator.Validate(); }