Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

61 lignes
2.9KB

  1. <%
  2. Class StringBuilder_Tests
  3. Public Sub Setup : End Sub
  4. Public Sub Teardown : End Sub
  5. Public Function TestCaseNames
  6. TestCaseNames = Array("Test_Initialized_Object_Should_Be_Empty", _
  7. "Test_StringBuilder_Function_Should_Return_Initialized_Object", _
  8. "Test_Default_Property_Should_Be_String", _
  9. "Test_Default_String_Should_Not_Have_Spaces_Between_Entries", _
  10. "Test_Join_Should_Allow_Custom_Delimiter_Between_Entries")
  11. End Function
  12. '---------------------------------------------------------------------------------------------------------------------
  13. Public Sub Test_Initialized_Object_Should_Be_Empty(T)
  14. dim SB : set SB = new StringBuilder_Class
  15. T.AssertEqual "", SB.TO_String, "Initialized object does not have an empty string."
  16. set SB = Nothing
  17. End Sub
  18. '---------------------------------------------------------------------------------------------------------------------
  19. Public Sub Test_StringBuilder_Function_Should_Return_Initialized_Object(T)
  20. dim SB : set SB = new StringBuilder_Class
  21. T.AssertEqual "", SB.TO_String, "StringBuilder() function did not return initialized object."
  22. set SB = Nothing
  23. End Sub
  24. '---------------------------------------------------------------------------------------------------------------------
  25. Public Sub Test_Default_Property_Should_Be_String(T)
  26. dim SB : set SB = StringBuilder()
  27. T.AssertType "String", typename( (SB) ), "Object should default to string output."
  28. set SB = Nothing
  29. End Sub
  30. '---------------------------------------------------------------------------------------------------------------------
  31. Public Sub Test_Default_String_Should_Not_Have_Spaces_Between_Entries(T)
  32. dim SB : set SB = StringBuilder()
  33. SB.Add "foo"
  34. SB.Add "bar"
  35. SB.Add "baz"
  36. T.AssertEqual "foobarbaz", SB.TO_String, "Default string should not have spaces between entries."
  37. set SB = Nothing
  38. End Sub
  39. '---------------------------------------------------------------------------------------------------------------------
  40. Public Sub Test_Join_Should_Allow_Custom_Delimiter_Between_Entries(T)
  41. dim SB : set SB = StringBuilder()
  42. SB.Add "foo"
  43. SB.Add "bar"
  44. SB.Add "baz"
  45. T.AssertEqual "foo bar baz", SB.Get(" "), "Get() should allow a space between entries."
  46. T.AssertEqual "foo---bar---baz", SB.Get("---"), "Get() should allow --- between entries."
  47. T.AssertEqual "foo" & Chr(27) & "bar" & Chr(27) & "baz", SB.Get(Chr(27)), "Get() should allow non-standard ASCII character between entries."
  48. set SB = Nothing
  49. End Sub
  50. End Class
  51. %>

Powered by TurnKey Linux.