Guest User

Untitled

a guest
Jan 18th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. - if_file_exists_load_entries ()
  2. - if_file_missing_load_last ()
  3. - if_no_files_create_new_entries ()
  4. - if_exception_clear_entries_and_log ()
  5. - loaded_entries_init_called ()
  6. - Other tests
  7.  
  8. - if_file_exists_load_entries _AND_STORE_AS_LAST()
  9. - if_file_missing_load_last _AND_STORE_AS_LAST_AND_WARNING_MESSAGE()
  10. - if_no_files_create_new_entries _AND_WARNING_MESSAGE()
  11. - if_exception_clear_entries_and_log _AND_ERROR_MESSAGE()
  12. - loaded_entries_init_called _AND_SUCCESS_MESSAGE()
  13. - Other tests
  14.  
  15. - if_file_exists_load_entries _AND_INFO_MESSAGE()
  16. - if_file_missing_load_last _AND_INFO_MESSAGE()
  17. - if_no_files_create_new_entries _AND_INFO_MESSAGE()
  18. - if_exception_clear_entries_and_log _AND_ERROR_MESSAGE_AND_SHUTDOWN()
  19. - loaded_entries_init_called _AND_SUCCESS_MESSAGE()
  20. - Other tests
  21.  
  22. // Public method tests
  23. [TestFixture]
  24. public class PublicMethodTests: IBehaviour1Test
  25. {
  26. // Behaviour 1
  27. Behaviour1Test _behaviour1;
  28. IEnumerable<TestCaseData> Behaviour1TestCases{ get { return _behaviour1.GetTestCases(); } }
  29. [Test]
  30. [TestCaseSource("Behaviour1TestCases")]
  31. public void RunBehaviour1Test(Action<IBehaviour1Test> runTestCase)
  32. {
  33. runTestCase(this);
  34. }
  35.  
  36. // ==============================
  37. // Behaviour 1 Arrange/act/assert
  38. void IBehaviour1Test.Arrange(){}
  39. void IBehaviour1Test.Assert(object result){}
  40. object IBehaviour1Test.Act()
  41. {
  42. return _model.PublicMethod();
  43. }
  44.  
  45. // Other tests
  46. }
  47.  
  48. // Implement this in order to run Behaviour1 test cases
  49. interface IBehaviour1Test
  50. {
  51. void Arrange();
  52. object Act();
  53. void Assert(object retValue);
  54. }
  55.  
  56. // Collection of tests for behaviour 1
  57. public class Behaviour1Test
  58. {
  59. // Generate test cases
  60. IEnumerable<TestCaseData>() GetTestCases()
  61. {
  62. yield return new TestCaseData((Action<IBehaviour1Test>)Test_1);
  63. yield return new TestCaseData((Action<IBehaviour1Test>)Test_2);
  64. yield return new TestCaseData((Action<IBehaviour1Test>)Test_3);
  65. }
  66.  
  67. void Test_1(IBehaviour1Test impl)
  68. {
  69. // Arrange
  70. impl.Arrange(); // public method's arrange
  71. Test1Setup(); // Arrange for this test
  72.  
  73. // Act
  74. var result = impl.Act();
  75.  
  76. // Assert
  77. Test1Assert(result); // Assert for this test
  78. impl.Assert(result); // Assert on public method
  79.  
  80. }
  81.  
  82. void Test_2(IBehaviour1Test impl){}
  83. void Test_3(IBehaviour1Test impl){}
  84. }
  85.  
  86. private void verifyField(expected1, extpected2, ....){
  87. equals(actual1, expected1, 'expected1 correct);
  88. ....
  89. }
Add Comment
Please, Sign In to add comment