public void TryValidate_ShouldCallValidate() { //Test sanity check Assert.IsFalse(mValidateCalled); mSut.TryValidate(Substitute.For <IMessageBoxService>()); Assert.IsTrue(mValidateCalled); }
public void Sut_ShouldCoordinateValidation(string strMatch, string regexMatchStr, int expectedMessageBoxCalls) { mSut.Initialize(); StringMatch stringMatch = (StringMatch)mSut.Properties.Single(p => p.GetType() == typeof(StringMatch)); RegexMatch regexMatch = (RegexMatch)mSut.Properties.Single(p => p.GetType() == typeof(RegexMatch)); stringMatch.Value = strMatch; regexMatch.Value = regexMatchStr; stringMatch.TryValidate(mMessageBoxService); mMessageBoxService.Received(expectedMessageBoxCalls).ShowError("Either 'String to Match' or 'Regex to Match' must be specified."); }