Beispiel #1
0
        public void CheckNeedsIsNotNull()
        {
            var container = new CatLib.Stl.Container();
            var bindData  = new CatLib.Stl.BindData(container, "NeedsIsNotNull", (app, param) => "hello world", false);

            var needs         = bindData.Needs("TestService");
            var needsWithType = bindData.Needs <BindDataTest>();

            Assert.AreNotEqual(null, needs);
            Assert.AreNotEqual(null, needsWithType);
        }
Beispiel #2
0
        public void CanGetContextual()
        {
            var container = new CatLib.Stl.Container();
            var bindData  = new CatLib.Stl.BindData(container, "NeedsIsNotNull", (app, param) => "hello world", false);

            bindData.Needs("need1").Given("abc");
            bindData.Needs("need2").Given <BindDataTest>();

            Assert.AreEqual("abc", bindData.GetContextual("need1"));
            Assert.AreEqual(typeof(BindDataTest).ToString(), bindData.GetContextual("need2"));
            Assert.AreEqual("empty", bindData.GetContextual("empty"));
        }
Beispiel #3
0
        public void CheckNeedsIllegalValue()
        {
            var container = new CatLib.Stl.Container();
            var bindData  = new CatLib.Stl.BindData(container, "CheckNeedsIllegalValue", (app, param) => "hello world", false);

            ExceptionAssert.Throws <ArgumentNullException>(() =>
            {
                bindData.Needs(null);
            });

            ExceptionAssert.Throws <ArgumentNullException>(() =>
            {
                bindData.Needs(string.Empty);
            });
        }