salesforce_certification_calculator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +114 -0
  3. data/Rakefile +15 -0
  4. data/bin/salesforce_certification_calculator +5 -0
  5. data/data/Administrator-Spring2022.xml +40 -0
  6. data/data/AdvancedAdministrator-Spring2022.xml +40 -0
  7. data/data/B2BSolutionArchitect-Spring2022.xml +30 -0
  8. data/data/B2CSolutionArchitect-Spring2022.xml +30 -0
  9. data/data/DataArchitect-Spring2022.xml +35 -0
  10. data/data/DevelopmentLifecycleAndDeploymentArchitect-Spring2022.xml +45 -0
  11. data/data/EducationCloudConsultant-Spring2022.xml +35 -0
  12. data/data/ExperienceCloudConsultant-Spring2022.xml +45 -0
  13. data/data/IdentityAndAccessManagementArchitect-Spring2022.xml +35 -0
  14. data/data/IntegrationArchitect-Spring2022.xml +35 -0
  15. data/data/JavaScriptDeveloperI-Spring2022.xml +40 -0
  16. data/data/MarketingCloudAdministrator-Spring2022.xml +30 -0
  17. data/data/MarketingCloudConsultant-Spring2022.xml +35 -0
  18. data/data/MarketingCloudDeveloper-Spring2022.xml +30 -0
  19. data/data/MarketingCloudEmailSpecialist-Spring2022.xml +30 -0
  20. data/data/PlatformAppBuilder-Spring2022.xml +30 -0
  21. data/data/PlatformDeveloperI-Spring2022.xml +25 -0
  22. data/data/PlatformDeveloperII-Spring2022.xml +30 -0
  23. data/data/SalesCloudConsultant-Spring2022.xml +55 -0
  24. data/data/ServiceCloudConsultant-Spring2022.xml +50 -0
  25. data/data/SharingAndVisibilityArchitect-Spring2022.xml +20 -0
  26. data/lib/salesforce_certification_calculator/exam.rb +63 -0
  27. data/lib/salesforce_certification_calculator/file_reader.rb +53 -0
  28. data/lib/salesforce_certification_calculator/section.rb +25 -0
  29. data/lib/salesforce_certification_calculator/u_i.rb +107 -0
  30. data/lib/salesforce_certification_calculator.rb +92 -0
  31. data/test/test_exam.rb +498 -0
  32. data/test/test_file_reader.rb +65 -0
  33. data/test/test_salesforce_certification_calculator.rb +189 -0
  34. data/test/test_section.rb +59 -0
  35. data/test/test_u_i.rb +297 -0
  36. metadata +98 -0
data/test/test_exam.rb ADDED
@@ -0,0 +1,498 @@
1
+ require "minitest/autorun"
2
+ require "nokogiri"
3
+ require "salesforce_certification_calculator"
4
+
5
+ class ExamTest < Minitest::Test
6
+ Exam = SalesforceCertificationCalculator::Exam
7
+ @@exam = Exam.new
8
+ @@methods = @@exam.methods
9
+
10
+ def test_initialize_title_exists
11
+ assert_includes @@methods, :title, "should create an object with a title attribute"
12
+ end
13
+
14
+ def test_initialize_title_setter
15
+ assert_includes @@methods, :title=, "should create an object with a method for setting the title attribute"
16
+ end
17
+
18
+ def test_initialize_title_string
19
+ assert_instance_of String, @@exam.title, "should create an object with a title attribute of type string"
20
+ end
21
+
22
+ def test_initialize_file_exists
23
+ assert_includes @@methods, :file, "should create an object with a file attribute"
24
+ end
25
+
26
+ def test_initialize_file_setter
27
+ assert_includes @@methods, :file=, "should create an object with a method for setting the file attribute"
28
+ end
29
+
30
+ def test_initialize_file_string
31
+ assert_instance_of String, @@exam.file, "should create an object with a file attribute of type string"
32
+ end
33
+
34
+ def test_initialize_sections_exists
35
+ assert_includes @@methods, :sections, "should create an object with a sections attribute"
36
+ end
37
+
38
+ def test_initialize_sections_array
39
+ assert_instance_of Array, @@exam.sections, "should create an object with a sections attribute of type array"
40
+ end
41
+
42
+ def test_initialize_total_exists
43
+ assert_includes @@methods, :total, "should create an object with a total attribute"
44
+ end
45
+
46
+ def test_initialize_total_integer
47
+ assert_instance_of Integer, @@exam.total, "should create an object with a total attribute of type integer"
48
+ end
49
+
50
+ def test_add_section_exists
51
+ assert_includes @@methods, :add_section, "should create an object with a method called add_section"
52
+ end
53
+
54
+ def test_calculate_total_exists
55
+ assert_includes @@methods, :calculate_total, "should create an object with a method called calculate_total"
56
+ end
57
+
58
+ def test_add_section_name_weight_increments
59
+ initial_sections = @@exam.sections.length
60
+ @@exam.add_section("Database", 24)
61
+ updated_sections = @@exam.sections.length
62
+
63
+ assert_equal initial_sections + 1, updated_sections, "should add a new section to exam object when invoke add_section method without score"
64
+ end
65
+
66
+ def test_add_section_name_weight_default_0_score
67
+ @@exam.add_section("Database", 24)
68
+ sections_length = @@exam.sections.length
69
+ recent_section = @@exam.sections[sections_length - 1]
70
+
71
+ assert_equal 0, recent_section.score, "should give new section a score of 0 if no score parameter supplied"
72
+ end
73
+
74
+ def test_add_section_name_weight_score_increments
75
+ initial_sections = @@exam.sections.length
76
+ @@exam.add_section("Database", 24, 80)
77
+ updated_sections = @@exam.sections.length
78
+
79
+ assert_equal initial_sections + 1, updated_sections, "should add a new section to exam object when invoke add_section method with score"
80
+ end
81
+
82
+ def test_add_section_name_weight_score_new_value
83
+ score_value = 80
84
+ @@exam.add_section("Database", 24, score_value)
85
+ sections_length = @@exam.sections.length
86
+ recent_section = @@exam.sections[sections_length - 1]
87
+
88
+ assert_equal score_value, recent_section.score, "should give new section a score matching the score parameter if supplied"
89
+ end
90
+
91
+ def test_calculate_total_1_section
92
+ exam = Exam.new
93
+ exam.add_section("Database", 100, 65)
94
+ exam.calculate_total
95
+
96
+ assert_equal 65, exam.total, "should set total to first section's score if exam contains only 1 section with a weight of 100 after invoking calculate_total"
97
+ end
98
+
99
+ def test_calculate_total_2_sections
100
+ exam = Exam.new
101
+ exam.add_section("Database", 40, 65)
102
+ exam.add_section("Application", 60, 85)
103
+ exam.calculate_total
104
+
105
+ assert_equal 77, exam.total, "should set total correctly when calculate_total called on exam containing 2 sections"
106
+ end
107
+
108
+ def test_calculate_total_3_sections
109
+ exam = Exam.new
110
+ exam.add_section("Database", 25, 62)
111
+ exam.add_section("Application", 35, 83)
112
+ exam.add_section("Program", 40, 54)
113
+ exam.calculate_total
114
+
115
+ assert_equal 66.15, exam.total, "should set total correctly when calculate_total called on exam containing 3 sections"
116
+ end
117
+
118
+ def test_calculate_total_many_sections
119
+ exam = Exam.new
120
+ exam.add_section("Section 1", 5, 82)
121
+ exam.add_section("Section 2", 6, 93)
122
+ exam.add_section("Section 3", 7, 54)
123
+ exam.add_section("Section 4", 8, 62)
124
+ exam.add_section("Section 5", 9, 80)
125
+ exam.add_section("Section 6", 10, 40)
126
+ exam.add_section("Section 7", 12, 50)
127
+ exam.add_section("Section 8", 13, 60)
128
+ exam.add_section("Section 9", 14, 70)
129
+ exam.add_section("Section 10", 16, 65)
130
+ exam.calculate_total
131
+
132
+ assert_equal 63.62, exam.total, "should set total correctly when calculate_total called on exam containing multiple sections"
133
+ end
134
+
135
+ def test_calculate_total_administrator
136
+ exam = Exam.new
137
+ exam.file = "data/Administrator-Spring2022.xml"
138
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
139
+ names = doc.xpath("//name")
140
+ weights = doc.xpath("//weight")
141
+
142
+ (0..names.length-1).each do |i|
143
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
144
+ end
145
+
146
+ exam.calculate_total
147
+
148
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Administrator data"
149
+ end
150
+
151
+ def test_calculate_total_advanced_administrator
152
+ exam = Exam.new
153
+ exam.file = "data/AdvancedAdministrator-Spring2022.xml"
154
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
155
+ names = doc.xpath("//name")
156
+ weights = doc.xpath("//weight")
157
+
158
+ (0..names.length-1).each do |i|
159
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
160
+ end
161
+
162
+ exam.calculate_total
163
+
164
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Advanced Administrator data"
165
+ end
166
+
167
+ def test_calculate_total_b2b_solution_architect
168
+ exam = Exam.new
169
+ exam.file = "data/B2BSolutionArchitect-Spring2022.xml"
170
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
171
+ names = doc.xpath("//name")
172
+ weights = doc.xpath("//weight")
173
+
174
+ (0..names.length-1).each do |i|
175
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
176
+ end
177
+
178
+ exam.calculate_total
179
+
180
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with B2B Solution Architect data"
181
+ end
182
+
183
+ def test_calculate_total_b2c_solution_architect
184
+ exam = Exam.new
185
+ exam.file = "data/B2CSolutionArchitect-Spring2022.xml"
186
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
187
+ names = doc.xpath("//name")
188
+ weights = doc.xpath("//weight")
189
+
190
+ (0..names.length-1).each do |i|
191
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
192
+ end
193
+
194
+ exam.calculate_total
195
+
196
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with B2C Solution Architect data"
197
+ end
198
+
199
+ def test_calculate_total_data_architect
200
+ exam = Exam.new
201
+ exam.file = "data/DataArchitect-Spring2022.xml"
202
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
203
+ names = doc.xpath("//name")
204
+ weights = doc.xpath("//weight")
205
+
206
+ (0..names.length-1).each do |i|
207
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
208
+ end
209
+
210
+ exam.calculate_total
211
+
212
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Data Architect data"
213
+ end
214
+
215
+ def test_calculate_total_development_lifecycle_and_deployment_architect
216
+ exam = Exam.new
217
+ exam.file = "data/DevelopmentLifecycleAndDeploymentArchitect-Spring2022.xml"
218
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
219
+ names = doc.xpath("//name")
220
+ weights = doc.xpath("//weight")
221
+
222
+ (0..names.length-1).each do |i|
223
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
224
+ end
225
+
226
+ exam.calculate_total
227
+
228
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Development Lifecycle and Deployment Architect data"
229
+ end
230
+
231
+ def test_calculate_total_education_cloud_consultant
232
+ exam = Exam.new
233
+ exam.file = "data/EducationCloudConsultant-Spring2022.xml"
234
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
235
+ names = doc.xpath("//name")
236
+ weights = doc.xpath("//weight")
237
+
238
+ (0..names.length-1).each do |i|
239
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
240
+ end
241
+
242
+ exam.calculate_total
243
+
244
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Education Cloud Consultant data"
245
+ end
246
+
247
+ def test_calculate_total_experience_cloud_consultant
248
+ exam = Exam.new
249
+ exam.file = "data/ExperienceCloudConsultant-Spring2022.xml"
250
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
251
+ names = doc.xpath("//name")
252
+ weights = doc.xpath("//weight")
253
+
254
+ (0..names.length-1).each do |i|
255
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
256
+ end
257
+
258
+ exam.calculate_total
259
+
260
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Experience Cloud Consultant data"
261
+ end
262
+
263
+ def test_calculate_total_identity_and_access_management_architect
264
+ exam = Exam.new
265
+ exam.file = "data/IdentityAndAccessManagementArchitect-Spring2022.xml"
266
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
267
+ names = doc.xpath("//name")
268
+ weights = doc.xpath("//weight")
269
+
270
+ (0..names.length-1).each do |i|
271
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
272
+ end
273
+
274
+ exam.calculate_total
275
+
276
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Identity and Access Management Architect data"
277
+ end
278
+
279
+ def test_calculate_total_integration_architect
280
+ exam = Exam.new
281
+ exam.file = "data/IntegrationArchitect-Spring2022.xml"
282
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
283
+ names = doc.xpath("//name")
284
+ weights = doc.xpath("//weight")
285
+
286
+ (0..names.length-1).each do |i|
287
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
288
+ end
289
+
290
+ exam.calculate_total
291
+
292
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Integration Architect data"
293
+ end
294
+
295
+ def test_calculate_total_javascript_developer_i
296
+ exam = Exam.new
297
+ exam.file = "data/JavaScriptDeveloperI-Spring2022.xml"
298
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
299
+ names = doc.xpath("//name")
300
+ weights = doc.xpath("//weight")
301
+
302
+ (0..names.length-1).each do |i|
303
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
304
+ end
305
+
306
+ exam.calculate_total
307
+
308
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with JavaScript Developer I data"
309
+ end
310
+
311
+ def test_calculate_total_marketing_cloud_administrator
312
+ exam = Exam.new
313
+ exam.file = "data/MarketingCloudAdministrator-Spring2022.xml"
314
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
315
+ names = doc.xpath("//name")
316
+ weights = doc.xpath("//weight")
317
+
318
+ (0..names.length-1).each do |i|
319
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
320
+ end
321
+
322
+ exam.calculate_total
323
+
324
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Marketing Cloud Administrator data"
325
+ end
326
+
327
+ def test_calculate_total_marketing_cloud_consultant
328
+ exam = Exam.new
329
+ exam.file = "data/MarketingCloudConsultant-Spring2022.xml"
330
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
331
+ names = doc.xpath("//name")
332
+ weights = doc.xpath("//weight")
333
+
334
+ (0..names.length-1).each do |i|
335
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
336
+ end
337
+
338
+ exam.calculate_total
339
+
340
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Marketing Cloud Consultant data"
341
+ end
342
+
343
+ def test_calculate_total_marketing_cloud_developer
344
+ exam = Exam.new
345
+ exam.file = "data/MarketingCloudDeveloper-Spring2022.xml"
346
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
347
+ names = doc.xpath("//name")
348
+ weights = doc.xpath("//weight")
349
+
350
+ (0..names.length-1).each do |i|
351
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
352
+ end
353
+
354
+ exam.calculate_total
355
+
356
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Marketing Cloud Developer data"
357
+ end
358
+
359
+ def test_calculate_total_marketing_cloud_email_specialist
360
+ exam = Exam.new
361
+ exam.file = "data/MarketingCloudEmailSpecialist-Spring2022.xml"
362
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
363
+ names = doc.xpath("//name")
364
+ weights = doc.xpath("//weight")
365
+
366
+ (0..names.length-1).each do |i|
367
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
368
+ end
369
+
370
+ exam.calculate_total
371
+
372
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Marketing Cloud Email Specialist data"
373
+ end
374
+
375
+ def test_calculate_total_platform_app_builder
376
+ exam = Exam.new
377
+ exam.file = "data/PlatformAppBuilder-Spring2022.xml"
378
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
379
+ names = doc.xpath("//name")
380
+ weights = doc.xpath("//weight")
381
+
382
+ (0..names.length-1).each do |i|
383
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
384
+ end
385
+
386
+ exam.calculate_total
387
+
388
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Platform App Builder data"
389
+ end
390
+
391
+ def test_calculate_total_platform_developer_i
392
+ exam = Exam.new
393
+ exam.file = "data/PlatformDeveloperI-Spring2022.xml"
394
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
395
+ names = doc.xpath("//name")
396
+ weights = doc.xpath("//weight")
397
+
398
+ (0..names.length-1).each do |i|
399
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
400
+ end
401
+
402
+ exam.calculate_total
403
+
404
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Platform Developer I data"
405
+ end
406
+
407
+ def test_calculate_total_platform_developer_ii
408
+ exam = Exam.new
409
+ exam.file = "data/PlatformDeveloperII-Spring2022.xml"
410
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
411
+ names = doc.xpath("//name")
412
+ weights = doc.xpath("//weight")
413
+
414
+ (0..names.length-1).each do |i|
415
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
416
+ end
417
+
418
+ exam.calculate_total
419
+
420
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Platform Developer II data"
421
+ end
422
+
423
+ def test_calculate_total_sales_cloud_consultant
424
+ exam = Exam.new
425
+ exam.file = "data/SalesCloudConsultant-Spring2022.xml"
426
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
427
+ names = doc.xpath("//name")
428
+ weights = doc.xpath("//weight")
429
+
430
+ (0..names.length-1).each do |i|
431
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
432
+ end
433
+
434
+ exam.calculate_total
435
+
436
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Sales Cloud Consultant data"
437
+ end
438
+
439
+ def test_calculate_total_service_cloud_consultant
440
+ exam = Exam.new
441
+ exam.file = "data/ServiceCloudConsultant-Spring2022.xml"
442
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
443
+ names = doc.xpath("//name")
444
+ weights = doc.xpath("//weight")
445
+
446
+ (0..names.length-1).each do |i|
447
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
448
+ end
449
+
450
+ exam.calculate_total
451
+
452
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Service Cloud Consultant data"
453
+ end
454
+
455
+ def test_calculate_total_sharing_and_visibility_architect
456
+ exam = Exam.new
457
+ exam.file = "data/SharingAndVisibilityArchitect-Spring2022.xml"
458
+ doc = File.open(exam.file) { |f| Nokogiri::XML(f) }
459
+ names = doc.xpath("//name")
460
+ weights = doc.xpath("//weight")
461
+
462
+ (0..names.length-1).each do |i|
463
+ exam.add_section(names[i].content, weights[i].content.to_i, 100)
464
+ end
465
+
466
+ exam.calculate_total
467
+
468
+ assert_equal 100, exam.total, "should set total correctly when calculate_total called on exam with Sharing and Visibility Architect data"
469
+ end
470
+
471
+ def test_calculate_total_fails_low
472
+ exam = Exam.new
473
+ exam.add_section("Section 1", 10, 100)
474
+ exam.add_section("Section 2", 15, 80)
475
+ exam.add_section("Section 3", 20, 60)
476
+ exam.calculate_total
477
+
478
+ assert_equal "CANNOT CALCULATE", exam.total, "should set total to CANNOT CALCULATE when calculate_total called on exam with section weights that add up to less than 100"
479
+ end
480
+
481
+ def test_calculate_total_fails_high
482
+ exam = Exam.new
483
+ exam.add_section("Section 1", 20, 100)
484
+ exam.add_section("Section 2", 30, 80)
485
+ exam.add_section("Section 3", 40, 60)
486
+ exam.add_section("Section 4", 50, 70)
487
+ exam.calculate_total
488
+
489
+ assert_equal "CANNOT CALCULATE", exam.total, "should set total to CANNOT CALCULATE when calculate_total called on exam with section weights that add up to more than 100"
490
+ end
491
+
492
+ def test_calculate_total_fails_no_sections
493
+ exam = Exam.new
494
+ exam.calculate_total
495
+
496
+ assert_equal "CANNOT CALCULATE", exam.total, "should set total to CANNOT CALCULATE when calculate_total called on exam with no sections"
497
+ end
498
+ end
@@ -0,0 +1,65 @@
1
+ require "minitest/autorun"
2
+ require "salesforce_certification_calculator"
3
+
4
+ class FileReaderTest < Minitest::Test
5
+ FR = SalesforceCertificationCalculator::FileReader
6
+ Exam = SalesforceCertificationCalculator::Exam
7
+ reader = FR.new
8
+ @@methods = reader.methods
9
+ @@exams = reader.generate_exams_list
10
+ @@exam = reader.extract_initial_exam_data(reader.generate_exams_list[0])
11
+
12
+ def test_generate_exams_list_exists
13
+ assert_includes @@methods, :generate_exams_list, "should create an object with a method called generate_exams_list"
14
+ end
15
+
16
+ def test_extract_initial_exam_data_exists
17
+ assert_includes @@methods, :extract_initial_exam_data, "should create an object with a method called extract_initial_exam_data"
18
+ end
19
+
20
+ def test_generate_exams_list_returns_array
21
+ assert_instance_of Array, @@exams, "should return array when invoke generate_exams_list"
22
+ end
23
+
24
+ def test_generate_exams_list_contains_21_items
25
+ assert_equal 21, @@exams.length, "should return array with 21 elements when invoke generate_exams_list"
26
+ end
27
+
28
+ def test_generate_exams_list_contains_exams
29
+ @@exams.each do |exam|
30
+ assert_instance_of Exam, exam, "should return array of Exam objects when invoke generate_exams_list"
31
+ end
32
+ end
33
+
34
+ def test_generate_exams_list_returns_no_sections
35
+ @@exams.each do |exam|
36
+ assert_equal 0, exam.sections.length, "should not return any sections on any of the exams listed"
37
+ end
38
+ end
39
+
40
+ def test_generate_exams_list_contains_administrator
41
+ exists = @@exams.any? { |exam| exam.title == "Administrator - Spring 2022" }
42
+
43
+ assert_equal true, exists, "should return array containing Administrator title when invoke generate_exams_list"
44
+ end
45
+
46
+ def test_generate_exams_list_contains_multiple_marketings
47
+ marketings = 0
48
+
49
+ @@exams.each do |exam|
50
+ if exam.title.include? "Marketing"
51
+ marketings += 1
52
+ end
53
+ end
54
+
55
+ assert_operator marketings, :>, 1, "should return array containing multiple objects with titles including Marketing when invoke generate_exams_list"
56
+ end
57
+
58
+ def test_extract_initial_exam_data_returns_exam
59
+ assert_instance_of Exam, @@exam, "should return Exam object when invoke extract_initial_exam_data"
60
+ end
61
+
62
+ def test_extract_initial_exam_data_returns_sections
63
+ assert_operator @@exam.sections.length, :>, 0, "should return Exam object with sections when invoke extract_initial_exam_data"
64
+ end
65
+ end