public void Validate_UseBreakWaterWithInvalidBreakWaterHeight_ErrorMessage( [Values(BreakWaterType.Wall, BreakWaterType.Caisson, BreakWaterType.Dam)] BreakWaterType type, [Values(double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double height) { // Setup var breakWater = mockRepository.Stub <IUseBreakWater>(); breakWater.UseBreakWater = true; breakWater.Stub(call => breakWater.BreakWater).Return(new BreakWater(type, height)); mockRepository.ReplayAll(); var rule = new UseBreakWaterRule(breakWater); // Call IEnumerable <string> messages = rule.Validate(); string[] validationMessages = messages.ToArray(); // Assert Assert.AreEqual(1, validationMessages.Length); const string expectedMessage = "De waarde voor 'hoogte' van de dam moet een concreet getal zijn."; StringAssert.StartsWith(expectedMessage, validationMessages[0]); mockRepository.VerifyAll(); }
public void Validate_ValidBreakWaterHeight_NoErrorMessage(BreakWaterType type) { // Setup var breakWater = mockRepository.Stub <IUseBreakWater>(); breakWater.UseBreakWater = true; breakWater.Stub(call => breakWater.BreakWater).Return(new BreakWater(type, 5.0)); mockRepository.ReplayAll(); var rule = new UseBreakWaterRule(breakWater); // Call IEnumerable <string> message = rule.Validate(); // Assert CollectionAssert.IsEmpty(message); mockRepository.VerifyAll(); }
public void Validate_DoesNotUseBreakWaterWithInvalidBreakWaterHeight_NoErrorMessage( [Values(BreakWaterType.Wall, BreakWaterType.Caisson, BreakWaterType.Dam)] BreakWaterType type, [Values(double.NaN, double.NegativeInfinity, double.PositiveInfinity)] double height) { // Setup var breakWater = mockRepository.Stub <IUseBreakWater>(); breakWater.UseBreakWater = false; breakWater.Stub(call => breakWater.BreakWater).Return(new BreakWater(type, height)); mockRepository.ReplayAll(); var rule = new UseBreakWaterRule(breakWater); // Call IEnumerable <string> message = rule.Validate(); // Assert CollectionAssert.IsEmpty(message); mockRepository.VerifyAll(); }