Question with C#/C++. Three small questions 1. This requirement determines wheth
ID: 3854151 • Letter: Q
Question
Question with C#/C++. Three small questions
1.
This requirement determines whether a verification email is sent to a patient when a Clincian updates the patient’s email address in the system. Define the minimum test cases needed to confirm the software under test correctly implemented the following requirement. Think big picture, not about the lower level details.
patient profile - initiate verification email
( Ref ID: REQ-123456-1 )
The system shall initiate an Email Verification Message to the Patient Email Address in the Patient Preferred Language when all of the following criteria are met:
· Patient Email Address is successfully updated
· Patient is a Mobile App User
· Patient has transmitted one or more transmissions
The system needs to verify that the updated patient email address is correct in order to ensure that health information is not sent to the wrong user.
2.
Simplify/fix the following code.
public class AccountInfo
{
public int AccountId { get; set; }
public string AccountName { get; set; };
public bool AccountActive { get; set; }
}
private static bool IsAccountActive(Guid accountId)
{
if(accountId == null)
{
throw new Exception(“Account id is null.”);
}
else
{
if(AccountIdExists(accountId) == true)
{
AccountInfo acctInfo = RetrieveAccountInformation(accountId);
if(acctInfo.AccountActive == true)
{
return acctInfo.AccountActive
}
else
{
return acctInfo.AccountActive
}
}
else
{
throw new Exception("Account with account id was not found.");
}
}
}
private static bool AccountIdExists(Guid accountId)
{
3.
Simplify/fix the following code.
public void SetAllAlertsToUrgencyForDevice(AlertType type, DeviceType deviceType)
{
if (deviceType == DeviceType.IPG)
{
switch (type)
{
case AlertType.Red:
var ipgRedRadioBtns = IPGTable.FindControlsById("Red");
foreach(var radioBtn in ipgRedRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
case AlertType.Yellow:
var ipgYellowRadioBtns = IPGTable.FindControlsById("Yello");
foreach (var radioBtn in ipgYellowRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
case AlertType.NoAlert:
var ipgNoAlertRadioBtns = IPGTable.FindControlsById("NoAlert");
foreach (var radioBtn in ipgNoAlertRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
}
}
Explanation / Answer
Hi,
Please find the answers to all the three questions below:-
=======================================================================================
1)
In order to verify that the updated patient email address is correct or not following test cases needs to be implemented
a) Three test cases:-It is necessary to individually check the three criteria’s which are given are met or not. I.e
(Test Case 1) TC1:- Patient Email Address is successfully updated.
TC2:- Patient is a Mobile App User.
TC3:- Patient has transmitted one or more transmissions
b) The last test case will put a test case whether all three criteria’s are met or not and if yes then a email verification mail is send to the patient.
TC4:-Whether Patient’s email address is updated and is a mobile app user and has one or
more transmissions or not.
The Test Cases Format will be:-
TC 1
To check Whether email address is updated or not.
Description
The test is applied to check whether the patient has updated the email address or not in the system.
Expected Result
If the email address of patient is not updated then it should throw error “Email Address is not updated” else no error.
Observed Result
TC 2
To check Whether patient is a mobile App user or not.
Description
The test is applied to check whether the patient is accessing the hospital’s application through mobile app or not.
Expected Result
If the patient is not using the mobile app then it will throw error “The patient is no a mobile App user” else no error.
Observed Result
TC 3
To check Whether patient has one or more transmissions or not.
Description
The test is applied to check whether the patient has mentioned about the transmissions or not.If no transmissions mentioned that means zero transmissions .
Expected Result
If the patient is not having any transmissions then it will throw error"Patient does not have any transmissions" or else no error.
Observed Result
TC 4
To check whether patients email address is updated and is a mobile app user and has more than one transmissions.
Description
To initiate the email verification the patients all the three details should be checked for email verification mail to be send.
Expected Result
If patients’ email address is updated and is a mobile app user and has more than one transmission listed the email verification is send to the patient.
Observed Result
____________________________________________________________________________________________
2)
The code is modified and proper comments are placed. The modified code can be seen in bold.
public class AccountInfo
{
public int AccountId; //they are datatype declaration not methods so get;set; removed
public string AccountName;
public bool AccountActive;
}
private static bool IsAccountActive(Guid accountId)
{
if(accountId == null)
{
throw new Exception(“Account id is null.”);
}
else
{
if(AccountIdExists(accountId) == true)
{
AccountInfo acctInfo = RetrieveAccountInformation(accountId);
if(acctInfo.AccountActive == true)
{
return acctInfo.AccountActive
}
else
{
return false //it is obvious to return false instead acctInfo.AccountActive
}
}
else
{
throw new Exception("Account with account id was not found.");
}
}
}
private static bool AccountIdExists(Guid accountId)
{
//this method will check the account id whether it actually resides in the database or not.
//accordingly it will return true or false
}
___________________________________________________________________________________________
3)
The code snippet seems to work fine but it does not have default statement. Also the default case is optional, but it is wise to include it as it can handle unexpected input also. So default statement is included over here:-
public void SetAllAlertsToUrgencyForDevice(AlertType type, DeviceType deviceType)
{
if (deviceType == DeviceType.IPG)
{
switch (type)
{
case AlertType.Red:
var ipgRedRadioBtns = IPGTable.FindControlsById("Red");
foreach(var radioBtn in ipgRedRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
case AlertType.Yellow:
var ipgYellowRadioBtns = IPGTable.FindControlsById("Yellow");
foreach (var radioBtn in ipgYellowRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
case AlertType.NoAlert:
var ipgNoAlertRadioBtns = IPGTable.FindControlsById("NoAlert");
foreach (var radioBtn in ipgNoAlertRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
default:
var ipgNoAlertRadioBtns = IPGTable.FindControlsById("UnRecognisable Alert");
foreach (var radioBtn in ipgNoAlertRadioBtns)
{
Mouse.Click(radioBtn);
}
break;
}
}
=======================================================================================
Please let me know in case of any queries.
TC 1
To check Whether email address is updated or not.
Description
The test is applied to check whether the patient has updated the email address or not in the system.
Expected Result
If the email address of patient is not updated then it should throw error “Email Address is not updated” else no error.
Observed Result
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.