I would like to test the following class Private Func<>
delegate method using MB Units Mirror.ForObject()
. However it is not reflecting the method. Could any please provide a way to do this?
Functionality Code class
public class AccountTransaction
{
private static readonly Func<decimal, decimal, decimal> NetAmountCalculator = (discountedValue, discountPecentage) => discountPecentage == 100 ? 0 : Math.Round(discountedValue / (1 - (discountPecentage / 100)), 2);
}
Test method
/// <summary>
/// NetAmountCalculator in normal flow
/// </summary>
[Test]
public void NetAmountCalculatorTest()
{
var cashTransaction = Mirror.ForObject(new AccountTransaction());
decimal discountedAmount = 90;
decimal discountPecentage = 10;
cashTransaction["NetAmountCalculator"].Invoke(discountedAmount , discountPecentage);
Assert.IsTrue(true);
}
I have referred MBUint help as well another nice help from google code