Beispiel #1
0
        public void Test_Should_Throw_BeanPresentException()
        {
            var beanCollection = new BeanCollection(typeof(ILangBean));

            beanCollection.AddBean(typeof(SpanishLangBean));
            Assert.Throws <BeanPresentException>(() => beanCollection.AddBean(typeof(Spanish2LangBean)));
        }
Beispiel #2
0
        public void Test_Should_FindBean()
        {
            var beanCollection = new BeanCollection(typeof(ILangBean));

            beanCollection.AddBean(typeof(SpanishLangBean));
            var beanConfig = new BeanConfig("Spanish", true);
            var beanData   = beanCollection.FindBean(beanConfig);

            Assert.NotNull(beanData);
            Assert.Equal(typeof(SpanishLangBean), beanData.TBean);
        }
Beispiel #3
0
        public void Test_Should_Throw_NotFoundBeanException(string beanName, bool throwExceptionIfNotFound, bool addSpanishLangBean)
        {
            var beanCollection = new BeanCollection(typeof(ILangBean));

            if (addSpanishLangBean)
            {
                beanCollection.AddBean(typeof(SpanishLangBean));
            }
            var beanConfig = new BeanConfig(beanName, throwExceptionIfNotFound);

            Assert.Throws <NotFoundBeanException>(() => beanCollection.FindBean(beanConfig));
        }