Example #1
0
        public void TestKeyAsObject()
        {
            MarkerClass value = new MarkerClass ();
            binding.Key (value);

            Assert.That (binding.key == value);
        }
Example #2
0
        public void TestKeyAsObject()
        {
            MarkerClass value = new MarkerClass();

            binding.Key(value);

            Assert.That(binding.key == value);
        }
Example #3
0
		public void TestBindValue ()
		{
			object testKeyValue = new MarkerClass ();
			binder.Bind(testKeyValue).To<InjectableDerivedClass> ();
			IBinding binding = binder.GetBinding (testKeyValue);
			Assert.IsNotNull (binding);
			Assert.That (binding.key == testKeyValue);
			Assert.That ((binding.value as object[])[0] == typeof(InjectableDerivedClass));
		}
Example #4
0
        public void TestBindValue()
        {
            object testKeyValue = new MarkerClass();

            binder.Bind(testKeyValue).To <InjectableDerivedClass> ();
            IBinding binding = binder.GetBinding(testKeyValue);

            Assert.IsNotNull(binding);
            Assert.That(binding.key == testKeyValue);
            Assert.That((binding.value as object[])[0] == typeof(InjectableDerivedClass));
        }
        public void TestIllegalValueBinding()
        {
            MarkerClass illegalValue = new MarkerClass ();

            Binder.BindingResolver resolver = delegate (IBinding binding){};
            TestDelegate testDelegate = delegate()
            {
                new InjectionBinding (resolver).Key<InjectableSuperClass> ().To<InjectableDerivedClass> ().ToValue (illegalValue);
            };
            InjectionException ex =
                Assert.Throws<InjectionException> (testDelegate);
            Assert.That (ex.type == InjectionExceptionType.ILLEGAL_BINDING_VALUE);
        }
        public void TestIllegalValueBinding()
        {
            MarkerClass illegalValue = new MarkerClass();

            Binder.BindingResolver resolver     = delegate(IBinding binding){};
            TestDelegate           testDelegate = delegate()
            {
                new InjectionBinding(resolver).Bind <InjectableSuperClass> ().To <InjectableDerivedClass> ().ToValue(illegalValue);
            };
            InjectionException ex =
                Assert.Throws <InjectionException> (testDelegate);

            Assert.That(ex.type == InjectionExceptionType.ILLEGAL_BINDING_VALUE);
        }