function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
public class TemperatureConverter { // Takes a Fahrenheit temperature and returns the Celsius equivalent. public static Decimal FahrenheitToCelsius(Decimal fh) { Decimal cs = (fh - 32) * 5/9; return cs.setScale(2); } }
@isTest private class TemperatureConverterTest { @isTest static void testWarmTemp() { Decimal celsius = TemperatureConverter.FahrenheitToCelsius(70); System.assertEquals(21.11,celsius); } @isTest static void testFreezingPoint() { Decimal celsius = TemperatureConverter.FahrenheitToCelsius(32); System.assertEquals(0,celsius); } @isTest static void testBoilingPoint() { Decimal celsius = TemperatureConverter.FahrenheitToCelsius(212); System.assertEquals(100,celsius,'Boiling point temperature is not expected.'); } @isTest static void testNegativeTemp() { Decimal celsius = TemperatureConverter.FahrenheitToCelsius(-10); System.assertEquals(-23.33,celsius); } }
Here is the test class
Refer this links
https://trailhead.salesforce.com/content/learn/modules/apex_testing/apex_testing_intro
https://www.tutorialspoint.com/apex/apex_testing.htm
https://webkul.com/blog/test-classes-in-apex-salesforce/
Refer to these links for apex class with its test classes.
http://www.sfdcpoint.com/salesforce/test-class-with-example-salesforce/
https://webkul.com/blog/test-classes-in-apex-salesforce/
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro
http://www.sfdc99.com/2013/05/14/how-to-write-a-test-class/
https://www.tutorialspoint.com/apex/apex_testing.htm
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha