For creating a Test class for task object you should keep these 3 points in mind :
1) Create test data for the Task object that will be used in the test class. 2) Create an instance of the TaskModel class using the test data. 3) Verify that the values of the properties in the TaskModel instance match the values in the test data.
Here is the test class ;
@isTest
private class TaskModelTest {
static void testTaskModel() {
// Create test data for Task object
Task tsk = new Task();
tsk.Subject = 'Test Task';
tsk.Status = 'Not Started';
tsk.Priority = 'Low';
tsk.Description = 'This is a test task';
// Create TaskModel instance using test data
TaskModel taskModel = new TaskModel(tsk);
// Verify that the values of properties in TaskModel instance match the test data
System.assertEquals(tsk.Subject, taskModel.get('Subject'));
System.assertEquals(tsk.Status, taskModel.get('Status'));
System.assertEquals(tsk.Priority, taskModel.get('Priority'));
System.assertEquals(tsk.Description, taskModel.get('Description'));
}
}
If it helps please mark this as best answer. Thank you.
For creating a Test class for task object you should keep these 3 points in mind :
1) Create test data for the Task object that will be used in the test class.
2) Create an instance of the TaskModel class using the test data.
3) Verify that the values of the properties in the TaskModel instance match the values in the test data.
Here is the test class ;
If it helps please mark this as best answer.
Thank you.