1.Simplify the following method
public int AMethod(bool first, bool second, bool third)
{
if (!first)
{
if (second)
{
if (third)
{
return OptionOne;
}
else if (!second)
{
return OptionTwo;
}
else
{
return OptionOne;
}
}
else
{
return OptionOne;
}
}
else if (!third)
{
if (!second)
{
return OptionTwo;
}
}
else if (!second)
{
return OptionTwo;
}
if (!(third || !second))
{
return OptionTwo;
}
return OptionOne;
}
2.Show how you validated the correctness of your revised AMethod method.
You are working on a legacy bank system that is converted to be unit testable. The requirements for the unit tests is that they have to:
You are assigned the task of implementing unit tests for the attached code snippet and are allowed to refactor the code provided you maintain the existing functionality.
1.Create unit tests for all public methods of AccountBl class that will satisfy aforementioned unit test requirements.
2.If possible create unit tests for DataStore class. Do you see any limitations in unit testing this class?
3.Refactor AccountBl method signature given that the only usage of AccountBl class is from a method similar to Program.Main