public void GetServiceB() { var app = new AppSetup().Start(new APlusBAppModule()); var container = app.GetAppContainer <IComponentContainer>(); IServiceB serviceA = container.CreateComponent <IServiceB>(); Assert.IsInstanceOfType(serviceA, typeof(ServiceB)); }
public void GetConfigB() { var app = new AppSetup().Start(new APlusBAppModule()); var container = app.GetAppContainer <IComponentContainer>(); var config = container.CreateComponent <ConfigB>(); Assert.IsNotNull(config); }
public void ADaoNotExists() { var app = new AppSetup().Start(new APlusBAppModule()); var container = app.GetAppContainer <IComponentContainer>(); Assert.ThrowsException <ComponentNotRegistedException>(() => { container.CreateComponent <IADao>(); }); }
public void GetConfig() { var app = new AppSetup().Start(new TestAppModule()); var container = app.GetAppContainer <IComponentContainer>(); var config = container.CreateComponent <SomeConfigWithoutAttribute>(); Assert.AreEqual("NoName", config.PlayerName); Assert.AreEqual(1, config.RootId); Assert.AreEqual(true, config.CanGenerateMinusNumber); Assert.AreEqual(123456, config.Seed); }
public void RemoveAsSelf() { var app = new AppSetup().Start(new RemoveComponentByComponentTypeTestAppModule()); var container = app.GetAppContainer <IComponentContainer>(); using (var scope = container.BeginScope("TEST")) { Assert.ThrowsException <ComponentNotRegistedException>(() => { scope.CreateComponent <Test2Config>(); }); } }