コード例 #1
0
        public virtual void GetInternalImpls()
        {
            "Given all required dlls".Given(() =>
                Log.Info("All required dll's are referenced."));

            "When using the Aspects".When(() =>
            {
                _loggerFactory = Aspects.GetLoggerFactory();
                _di = Aspects.GetIocDI();
                _genericDao = Aspects.GetGenericDao();
                _simpleDao = Aspects.GetSimpleDao();
            });

            "Then all internal implementations are returned".Then(() =>
            {
                _loggerFactory.Should().BeOfType<Log4netLoggerFactory>();
                _di.Should().BeOfType<WindsorDI>();
                _genericDao.Should().BeOfType<NHibernateDao>();
                _simpleDao.Should().BeOfType<NHibernateDao>();

                Log.InfoFormat(
                    "{0}ILoggerFactory  type = {1}" +
                    "{0}IDependencyInj  type = {2}" +
                    "{0}IGenericDao     type = {3}" +
                    "{0}ISimpleDao      type = {4}",
                    Environment.NewLine, _loggerFactory, _di, _genericDao, _simpleDao);
            });
        }
コード例 #2
0
        public virtual void GetImpl_NoSettings(bool dllExists, Type expected)
        {
            _moqChecker.Setup(s => s.CheckForDll(DllName)).Returns(dllExists);

            string.Format("Given dll available = {0} and NO Settings", dllExists).Given(() =>
                _provider = new IocProvider
                {
                    DependencyChecker = _moqChecker.Object,
                    Settings = null//<- no settings
                });

            WhenMsg.When(() =>
                _class = _provider.GetImpl());

            string.Format("Then a {0} should be returned", expected.Name).Then(() =>
                _class.GetType().Should().Be(expected));
        }
コード例 #3
0
 //, Type startupType) //? should the startupShell live here...
 /// <summary>
 /// Initializes a new Ioc Dependency Injector to provide the service instances.
 /// </summary>
 /// <param name="contractType">The WCF service contract type.</param>        
 public IocInstanceProvider(Type contractType)
 {
     _contractType = contractType;
     _di = Aspects.GetIocDI();
 }
コード例 #4
0
ファイル: Navigator.cs プロジェクト: dzstoever/ZenFacades
        private readonly Form _view1; //main view

        #endregion Fields

        #region Constructors

        static Navigator()
        {
            DI = Aspects.GetIocDI();
        }
コード例 #5
0
        public virtual void GetImpl_No_setting_key(bool dllExists, Type expected)
        {
            _moqChecker.Setup(s => s.CheckForDll(DllName)).Returns(dllExists);

            string.Format("Given dll available = {0} and NO '{1}' setting", dllExists, KeyName).Given(() =>
                _provider = new IocProvider
                {
                    DependencyChecker = _moqChecker.Object,
                    Settings = new NameValueCollection()// <- don't contain the key
                });

            WhenMsg.When(() =>
                _class = _provider.GetImpl());

            string.Format("Then a {0} should be returned", expected.Name).Then(() =>
                _class.GetType().Should().Be(expected));
        }
コード例 #6
0
        public virtual void GetImpl_Valid_setting(bool dllExists, string setting, Type expected)
        {
            _moqChecker.Setup(s => s.CheckForDll(DllName)).Returns(dllExists);

            string.Format("Given dllAvailable = {0} and setting is [{1}]", dllExists, setting).Given(() =>
                _provider = new IocProvider
                {
                    DependencyChecker = _moqChecker.Object,
                    Settings = new NameValueCollection { { KeyName, setting } }
                });

            WhenMsg.When(() =>
                _class = _provider.GetImpl());

            string.Format("Then a {0} should be returned", expected.Name).Then(() =>
                _class.GetType().Should().Be(expected));
        }