using Ninject.Core;
[TestClass]
public class ChangePaymentSourceTest
{
[TestMethod]
public void PaymentSourceChange()
{
// ninject mapping
var module = new InlineModule(
m=>m.Bind<IDataProvider>().To<TestProvider>(),
m=>m.Bind<IFeeCanceller>().To<FeeCanceller>(),
m=>m.Bind<IFeeCreator>().To<FeeCreator>(),
m => m.Bind<IAccountSynchroniser>().To<AccountSynchroniser>(),
m => m.Bind<IPaymentSourceChanger>().To<PaymentSourceChanger>()
);
//creation ninject kernel
var kernel = new StandardKernel(module);
// creation provider- test provider in our case
var provider = kernel.Get<IDataProvider>();
// getting data
IAccountBusinessObject account = provider.GetAccountBusinessObject(new AccountIdentity() { customer = 1, sub = 1 });
IInvoiceOriginator i = provider.GetInvoiceOriginator(1);
UserInfo userInfo = provider.getUserInfo(1);
var changer = kernel.Get<IPaymentSourceChanger>();
i = changer.ChangePaymentSource(userInfo, account,i, 2, 3, 1);
// 5.Synchronise account
var synchroniser = kernel.Get<IAccountSynchroniser>();
synchroniser.Synchronize(account);
Scope scope = provider.BeginTransaction();
provider.SaveInvoiceOriginator(i, scope);
provider.SaveAccountBusinessObject(account, scope);
provider.CommitTransaction(scope);
}
}
Thursday
ninject example
Subscribe to:
Post Comments (Atom)
imagemagic add text to image
rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...
-
Error:The element 'Schedule' has invalid child element 'RecurrenceRule'. List of possible elements expected: 'Occurring&...
-
Perfect blog post must include following elements (from 1 to 13): 1.Big catchy header in 30px font size 2.First copy of social links and com...
-
SetKeyDelay , 75 , 75 ;Exits AutoHotKey application. $^CapsLock:: ExitApp return ;Pauses AutoHotKey Script. F6:: Pause , Toggle, 1 $x:: ...
No comments:
Post a Comment