Exemplo n.º 1
0
        public void TestKeyAsObject()
        {
            MarkerClass value = new MarkerClass ();
            binding.Key (value);

            Assert.That (binding.key == value);
        }
Exemplo n.º 2
0
        public void TestKeyAsObject()
        {
            MarkerClass value = new MarkerClass();

            binding.Key(value);

            Assert.That(binding.key == value);
        }
Exemplo n.º 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));
		}
Exemplo n.º 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));
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }