Example #1
0
        public void Test_Should_Use_BeanName()
        {
            var beanOptions = new BeanOptions();

            beanOptions.UseBeanName(typeof(ILangBean), "Spanish");
            Assert.Equal("Spanish", beanOptions.InterfaceNameBag[typeof(ILangBean)].BeanName);
            Assert.False(beanOptions.InterfaceNameBag[typeof(ILangBean)].ThrowExceptionIfNotFound);
            beanOptions.UseBeanNameWithError(typeof(ILangBean), "Spanish 2");
            Assert.Equal("Spanish 2", beanOptions.InterfaceNameBag[typeof(ILangBean)].BeanName);
            Assert.True(beanOptions.InterfaceNameBag[typeof(ILangBean)].ThrowExceptionIfNotFound);
            beanOptions.UseBeanName <ILangBean>("Spanish 3");
            Assert.Equal("Spanish 3", beanOptions.InterfaceNameBag[typeof(ILangBean)].BeanName);
            Assert.False(beanOptions.InterfaceNameBag[typeof(ILangBean)].ThrowExceptionIfNotFound);
            beanOptions.UseBeanNameWithError <ILangBean>("Spanish 4");
            Assert.Equal("Spanish 4", beanOptions.InterfaceNameBag[typeof(ILangBean)].BeanName);
            Assert.True(beanOptions.InterfaceNameBag[typeof(ILangBean)].ThrowExceptionIfNotFound);
        }
Example #2
0
        public void Test_Should_Find_InterfaceBeanConfig()
        {
            var beanOptions = new BeanOptions();

            beanOptions.UseGlobalBeanName("Global");
            beanOptions.UseBeanNameWithError(typeof(ILangBean), "Spanish");
            var beanConfig = beanOptions.FindBeanConfig(typeof(ILangBean));

            Assert.Equal("Spanish", beanConfig.BeanName);
            Assert.True(beanConfig.ThrowExceptionIfNotFound);
        }