public void BeginWork() { var app = new AppSetup().Start(new TestAppModule()); IIdService t1, t2, t3; using (var work = app.BeginWork("t1")) { t1 = work.CreateComponent <IIdService>(); t2 = work.CreateComponent <IIdService>(); Assert.AreEqual(t1.Id, t2.Id); } using (var work = app.BeginWork("t2")) { t3 = work.CreateComponent <IIdService>(); Assert.AreNotEqual(t1.Id, t3.Id); } }
public void GetTwoRepos() { var app = new AppSetup().Start(new TestAppModule()); using (var work = app.BeginWork("")) { var repoOfInt = work.CreateComponent <IRepo <Order> >(); var repoOfString = work.CreateComponent <IRepo <User> >(); } }
public void Get() { var app = new AppSetup().Start(new TestAppModule()); using (var work = app.BeginWork("T")) { var aaa = work.CreateComponent <AAA>(); Assert.IsNotNull(aaa); } }
public void PublishEvent() { var app = new AppSetup().Start(new TestAppModule()); using (var work = app.BeginWork("t1")) { work.PublishEvent(new TestEvent(this)); Assert.AreEqual("TEST", app.Context["TEST"]); } }
public void TestLifetime() { var app = new AppSetup().Start(new TestAppModule()); using (var worker = app.BeginWork("T")) { var component = worker.CreateComponent <IComponentListenerToLifetime>(); Assert.AreEqual(component.GetType(), app.Context["LastCreating"]); Assert.AreEqual(component.GetType(), app.Context["LastCreated"]); } }
public void Impl() { var app = new AppSetup().Start(new TestAppModule()); using (var work = app.BeginWork("t1")) { var b = work.CreateComponent <IInterfaceB>(); int i = b.MethodA(); Assert.AreEqual(1, i); } }
public void WorkInWork() { var app = new AppSetup().Start(new TestAppModule()); IIdService t1, t2, t3, t4 ; using (var w = app.BeginWork("t")) { t1 = w.CreateComponent <IIdService>(); using (var w1 = w.BeginWork("t1")) { t2 = w1.CreateComponent <IIdService>(); t3 = w1.CreateComponent <IIdService>(); Assert.AreEqual(t2.Id, t3.Id); Assert.AreNotEqual(t1.Id, t2.Id); } t4 = w.CreateComponent <IIdService>(); Assert.AreEqual(t1.Id, t4.Id); } }