I would like to do two test cases that are evaluating on their boolean value.
public string ActivateAgent(bool trueorfalse)
{
agentActivationStatus = true;
agentPriviledge = true;
return $"Agent activation status {agentActivationStatus}, SHD priviledges {agentPriviledge}, Agent {surname} is now active";
}
I've only done unit tests with integer and strings, never a bool. This is the TestCase I tried to create:
[TestCase(true)]
public void AgentIsActivated(bool expected)
{
bool result = Agent.ActivateAgent(bool true);
Assert.AreEqual(expected, result);
}
All I want to test is whether the agent is activated.
This is the full class for Agent, pretty basic but I'm new to C#.
public class Agent
{
string agentID;
public bool agentActivationStatus = false; //activated yes no
bool agentPriviledge = false; //has agent priviledges
int waveStatus;
public bool agentStatus = false;
public DateTime agentLastSeen = DateTime.Now; //agent last seen alive
public readonly string forename; //agent first name
public readonly string surname; //agent last name;
//CONSTRUCTORS --------------------------------------------------
public Agent(string fname, string lname)
{
forename = fname;
surname = lname;
string fullname = fname + " " + lname;
}
//METHODS --------------------------------------------------------
public string ActivateAgent(bool trueorfalse)
{
agentActivationStatus = true;
agentPriviledge = true;
return $"Agent activation status {agentActivationStatus}, SHD priviledges {agentPriviledge}, Agent {surname} is now active";
}
public string DeactivateAgent(bool trueorfalse)
{
agentActivationStatus = false;
agentPriviledge = false;
return $"Agent activation status {agentActivationStatus}, SHD priviledges {agentPriviledge}, Agent {surname} is now unactive.";
}
public string getAgentStatus()
{
return $"Agent activation is {agentActivationStatus}, Agent is active";
}
//public string getAgentStatus()
//{
// //string result = " ";
// //DateTime lastSeen30Days = agentLastSeen.AddDays(30);
// //if (agentLastSeen > lastSeen30Days && agentPriviledge ==)
// //{
// // result = $"Agent was last seen {lastSeen30Days}, Agent is presumed MIA ";
// //}
// //else if (agentStatus == false && agentPriviledge == true)
// //{
// // result = $"Agent was last seen {agentLastSeen} deceased.";
// //}
// //else
// //{
// // result = $"Agent was last seen {agentLastSeen} Alive";
// //}
// //return result;
}