Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VolunteerManager

Create a unit test for the VolunteerManager mobile application. Specifically, your unit test will test the VolunteerManager structure.

VolunteerManager expected behaviors

  1. The structure can be initialized without parameters (i.e., VolunteerManager())
  2. The structure provides a volunteer method that provides the volunteer's name (String) and the hours (Int) to volunteer using the for argument. Here is an example for calling the function:
manager.volunteer("Paul", for: 4)
  1. If the volunteer's name is not yet in the dictionary, it should create a new entry in the dictionary and provide the given hours. However, if the hours is less than 0 then it should not add the volunteer at all. If the hours provided is over 20, then it should be changed to 20 (i.e., 30 -> 20).
  2. If the volunteer's name already exists in the dictionary, it should add the given hours to the previously set hours. For example, if Paul was assigned 4 hours and volunteers for 3 more, then their hours should show 7. When time is added and the volunteer's time goes over 20, then it should be changed to 20. For example, if Paul already has 15 hours and 10 hours is added, then it should be changed to 20 (instead of 25). If the added hours is negative, the hours should not be updated.

Instructions

  1. Create your unit tests inside VolunteerManagerTests/VolunteerManagerTests.swift.
  2. Your unit tests must test all expected behaviors of the VolunteerManager structure.
  3. Run your unit test. Expect your unit tests to fail because there are bugs in the structure.
  4. Use your unit test results to identify and fix the bugs in the VolunteerManager structure.
  5. Run the program to see it in action!

Hint: You can look at your test's code coverage to help you figure out if you have fully tested the VolunteerManager structure. You need to fix three bugs.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages