BTPhysicalAccount testerInstance = new BTPhysicalAccount(IvirtualAccounts, BTmarketIn, int);
I want to test a method of this class. that BTmarketIn is a concrete class and a method in this class is used in that method under test. So I needed to mock that method hence i tried this:
var readerAsk = Substitute.ForPartsOf<BTMarketInfo>();
readerAsk.When(x => x.GetAskPrice(Arg.Any<SymbolType>())).DoNotCallBase();
readerAsk.GetAskPrice(Arg.Any<SymbolType>()).Returns(2000);
readerAsk.When(x => x.GetBidPrice(Arg.Any<SymbolType>())).DoNotCallBase();
readerAsk.GetBidPrice(Arg.Any<SymbolType>()).Returns(2000);
it kept throwing null exception error and after some research I realized that you cannot mock non-virtual methods. So I do have an interface class of that BTMarketIn class IMarketInfo. Now I can mock an instance of this interface but I need an instance of BTMarketIn to pass as constructor argument. How do I resolve this issue?