public void GetConfigBeansTest() { ConfigBeanContainer_Accessor target = new ConfigBeanContainer_Accessor(); // TODO: Initialize to an appropriate value IEnumerable<ConfigBeanBase> actual; ConfigBeanBase appsettingsBean = new AppSettingsBean(); ConfigBeanBase fcconfigBean = new FCConfigBean(); target.Register(appsettingsBean); target.Register(fcconfigBean); actual = target.GetConfigBeans(); //actual不为空 Assert.IsNotNull(actual); //actual个数为2 int result = 0; using (IEnumerator<ConfigBeanBase> enumerator = actual.GetEnumerator()) { while (enumerator.MoveNext()) result++; } Assert.AreEqual(result, 2); //actual中含有AppSettingsBean和FCConfigBean bool ret = false; using (IEnumerator<ConfigBeanBase> enumerator = actual.GetEnumerator()) { while (enumerator.MoveNext()) { if (enumerator.Current.GetType().Name.Equals(appsettingsBean.GetType().Name)) { ret = true; break; } } } Assert.IsTrue(ret); ret = false; using (IEnumerator<IComponent> enumerator = actual.GetEnumerator()) { while (enumerator.MoveNext()) { if (enumerator.Current.GetType().Name.Equals(fcconfigBean.GetType().Name)) { ret = true; break; } } } Assert.IsTrue(ret); ConfigBeanBase testBean1 = new Arch.CFramework.AppInternals.Test.TestBean1.TestBean(); ConfigBeanBase testBean2 = new Arch.CFramework.AppInternals.Test.TestBean2.TestBean(); target.Register(testBean1); target.Register(testBean2); //actual个数为2 result = 0; using (IEnumerator<ConfigBeanBase> enumerator = actual.GetEnumerator()) { while (enumerator.MoveNext()) result++; } Assert.AreEqual(result, 2); }
public void GetConfigBeansTest() { ConfigBeanContainer_Accessor target = new ConfigBeanContainer_Accessor(); // TODO: Initialize to an appropriate value IEnumerable<Arch.CFramework.ConfigBean.Bean.ConfigBean> actual; AppSettingsBean appsettingsBean = new AppSettingsBean(); FCConfigBean fcconfigBean = new FCConfigBean(); target.Register(appsettingsBean); target.Register(fcconfigBean); actual = target.GetConfigBeans(); Assert.IsNotNull(actual); }