Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public void GetConfigB()
        {
            var app       = new AppSetup().Start(new APlusBAppModule());
            var container = app.GetAppContainer <IComponentContainer>();
            var config    = container.CreateComponent <ConfigB>();

            Assert.IsNotNull(config);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 5
0
        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>();
                });
            }
        }