Thursday

ninject example

       
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);
}
}

No comments:

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...