I'm having trouble getting my method to search for a private static method. My boss wants this to be verified (although I understand that it really doesn’t need to be verified).
Here is the code I'm trying to verify:
namespace Retail_Utilities.Printables
{
public partial class WarrantyDropoffSlip : INotifyPropertyChanged
{
private static string AddBusinessDays(string businessDays)
{
if (string.IsNullOrEmpty(businessDays)) return DateTime.Now.ToShortDateString();
var bDays = int.Parse(businessDays);
var date = DateTime.Now;
while (bDays > 0)
{
date = date.AddDays(1);
if (date.DayOfWeek != DayOfWeek.Saturday && date.DayOfWeek != DayOfWeek.Sunday)
bDays--;
}
return date.ToShortDateString();
}
}
}
Here is my test code.
namespace RetailUtilitiesUnitTests.Printables_TEST
{
[TestClass]
public class WarrantyDropoffSlipTEST
{
[TestMethod]
public void AddBusinessdays_ValidInput()
{
PrivateObject po = new PrivateObject(typeof(WarrantyDropoffSlip));
object[] parameters = {"Sunday"};
po.Invoke("AddBusinessDays", parameters);
}
}
}
Any ideas?
source
share