/salesforce-tdd-dojo

Praticing TDD in Apex

Primary LanguageApexMIT LicenseMIT

Prepare your dev environment

Setup your dev environment

  1. Setup DX
  2. Install NPM
  3. Run the command npm install
  4. Run the npm script scratch:create:empty
  5. Run the npm script scratch:deploy

Apply TDD on thoses steps

Start with the Apex Class TDD_codingDojoExercice. Only add test when you completed a full TDD cycle.

Find the smallest and uniq factors of a given number.

Here are the tests with expected results:

  1. factors of null is null
  2. factors of 0 is 0
  3. factors of 1 is 1
  4. factors of 2 is [1,2]
  5. factors of 3 is [1,3]
  6. factors of 4 is [1,2]
  7. factors of 5 is [1,5]
  8. factors of 6 is [1,2,3]
  9. factors of 7 is [1,7]
  10. factors of 8 is [1,2]
  11. factors of 9 is [1,3]
  12. factors of 10 is [1,2,5]
  13. factors of 16 is [1,2]
  14. factors of 4620 is [1,2,3,5,7,11]

Annexes