public void Apply_EmptyString_EmptyReturned() { var TagOptions = string.Empty; var text = string.Empty; var randomTag = new RandomTag(TagOptions); string result = randomTag.Apply(text); Assert.True((result != null && result.Length == 0), "Empty input text should return empty output text"); }
public void Apply_LowerAlphas_ReturnsRandomizedNumber() { // This test caters for mask rules in accordance with the test input var TagOptions = ""; var text = "aaaa.aa.a.aaaa!"; var randomTag = new RandomTag(TagOptions); string result = randomTag.Apply(text); Match match = Regex.Match(result, @"[a-z]{4}\.[a-z]{2}\.[a-z]\.[a-z]{4}!", RegexOptions.Singleline); Assert.True(match.Success, "Fuzz logic should work according to the random tag rules"); }
public void Apply_Numerics_ReturnsRandomizedNumber() { // This test caters for mask rules in accordance with the test input var TagOptions = ""; var text = "+NNN(NNN) NNN-NNNN"; var randomTag = new RandomTag(TagOptions); string result = randomTag.Apply(text); Match match = Regex.Match(result, @"\+[0-9]{3}\([0-9]{3}\) [0-9]{3}-[0-9]{4}", RegexOptions.Singleline); Assert.True(match.Success, "Fuzz logic should work according to the random tag rules"); }
public void Apply_NonRandomOption_ExceptionReturned(Type type) { var TagOptions = string.Empty; var text = "mock text"; var returnException = new Exception(); dynamic nonRandomOption = Activator.CreateInstance(type); var randomTag = new RandomTag(TagOptions); try { randomTag.Apply(text, nonRandomOption); } catch (Exception ex) { returnException = ex; } Assert.True((returnException.GetType().Equals(new NoOptionsSuppliedException().GetType())), "Exception should be thrown if a non RandomOption is supplied."); }