public void ValidateString_LegitName_ShouldPass() { try { string test = Program.ValidateString("André"); Assert.Fail("No exception was thrown"); } catch (Exception ex) { Assert.IsTrue(ex is AssertFailedException); } }
public void ValidateString_ShortName_ShouldFail() { try { string test = Program.ValidateString(""); Assert.Fail(); } catch (Exception ex) { Assert.IsTrue(ex is Exception && ex is not AssertFailedException); } }
public void ValidateString_Null_ShouldFail() { try { string test = Program.ValidateString(null); Assert.Fail(); } catch (Exception ex) { Assert.IsTrue(ex is NullReferenceException); } }
public void ValidateString_LongName_ShouldFail() { try { string test = Program.ValidateString("JonasGardellHarEttVäldigtLångNamn"); Assert.Fail(); } catch (Exception ex) { Assert.IsTrue(ex is Exception && ex is not AssertFailedException); } }
public void ValidateString_CotainsNotALetter_ShouldFail() { try { string test = Program.ValidateString("!Test"); Assert.Fail("No exception was thrown"); } catch (Exception ex) { Assert.IsTrue(ex is Exception && ex is not AssertFailedException); } }