Esempio n. 1
0
		public void Invoking_by_name_works()
		{
			var target = new ClassWithGenericMethods();

			object value = new ClassWithGuidConstraint(Guid.NewGuid());

			target.FastInvoke("TwoGenericArgumentsOneParameter", value);

			target.TwoGenericArgumentsOneParameterCalled.ShouldBeTrue();
			target.FirstArgumentType.ShouldEqual(typeof(ClassWithGuidConstraint));
			target.FirstArgumentValue.ShouldEqual(value);
			target.SecondArgumentType.ShouldEqual(typeof (Guid));
		}
Esempio n. 2
0
		public void The_single_argument_two_type_method_should_be_invoked()
		{
			var target = new ClassWithGenericMethods();

			object value = new ClassWithGuidConstraint(Guid.NewGuid());

			target.FastInvoke(x => x.TwoGenericArgumentsOneParameter<ClassWithStringConstraint, string>(null), value);

			target.TwoGenericArgumentsOneParameterCalled.ShouldBeTrue();
			target.FirstArgumentType.ShouldEqual(typeof(ClassWithGuidConstraint));
			target.FirstArgumentValue.ShouldEqual(value);
			target.SecondArgumentType.ShouldEqual(typeof (Guid));
		}
Esempio n. 3
0
        public void Invoking_by_name_works()
        {
            var target = new ClassWithGenericMethods();

            object value = new ClassWithGuidConstraint(Guid.NewGuid());

            target.FastInvoke("TwoGenericArgumentsOneParameter", value);

            target.TwoGenericArgumentsOneParameterCalled.ShouldBeTrue();
            target.FirstArgumentType.ShouldEqual(typeof(ClassWithGuidConstraint));
            target.FirstArgumentValue.ShouldEqual(value);
            target.SecondArgumentType.ShouldEqual(typeof(Guid));
        }
Esempio n. 4
0
        public void The_single_argument_two_type_method_should_be_invoked()
        {
            var target = new ClassWithGenericMethods();

            object value = new ClassWithGuidConstraint(Guid.NewGuid());

            target.FastInvoke(x => x.TwoGenericArgumentsOneParameter <ClassWithStringConstraint, string>(null), value);

            target.TwoGenericArgumentsOneParameterCalled.ShouldBeTrue();
            target.FirstArgumentType.ShouldEqual(typeof(ClassWithGuidConstraint));
            target.FirstArgumentValue.ShouldEqual(value);
            target.SecondArgumentType.ShouldEqual(typeof(Guid));
        }
Esempio n. 5
0
        public void An_object_matching_the_constraint_should_properly_define_the_generic_type()
        {
            Guid id = CombGuid.Generate();

            var argument = new ClassWithGuidConstraint(id);

            var obj = FastActivator.Create(typeof(ClassWithAConstrainedGenericArgument <,>), argument);

            obj.ShouldNotBeNull();
            obj.ShouldBeAnInstanceOf <ClassWithAConstrainedGenericArgument <ClassWithGuidConstraint, Guid> >();

            var instance = (ClassWithAConstrainedGenericArgument <ClassWithGuidConstraint, Guid>)obj;

            instance.Value.ShouldEqual(argument);
        }
Esempio n. 6
0
		public void An_object_matching_the_constraint_should_properly_define_the_generic_type()
		{
			Guid id = CombGuid.Generate();

			var argument = new ClassWithGuidConstraint(id);

			var obj = FastActivator.Create(typeof (ClassWithAConstrainedGenericArgument<,>), argument);

			obj.ShouldNotBeNull();
			obj.ShouldBeAnInstanceOf<ClassWithAConstrainedGenericArgument<ClassWithGuidConstraint, Guid>>();

			var instance = (ClassWithAConstrainedGenericArgument<ClassWithGuidConstraint, Guid>) obj;

			instance.Value.ShouldEqual(argument);
		}