Exemplo n.º 1
0
        public void GenericArgumentConstructor(int iterations)
        {
            var argument = new SuperConstrainedClass(CombGuid.Generate());

            for (int i = 0; i < iterations; i++)
            {
                var obj = new ClassWithAConstrainedGenericArgument <SuperConstrainedClass, Guid>(argument);
            }
        }
Exemplo n.º 2
0
        public void GenericArgumentConstructor(int iterations)
        {
            var argument = new SuperConstrainedClass(CombGuid.Generate());

            for (int i = 0; i < iterations; i++)
            {
                var obj = FastActivator.Create(typeof(ClassWithAConstrainedGenericArgument <,>), argument);
            }
        }
Exemplo n.º 3
0
		public void GenericArgumentConstructor(int iterations)
		{
			var argument = new SuperConstrainedClass(CombGuid.Generate());

			for (int i = 0; i < iterations; i++)
			{
				var obj = new ClassWithAConstrainedGenericArgument<SuperConstrainedClass,Guid>(argument);
			}
		}
		public void GenericArgumentConstructor(int iterations)
		{
			var argument = new SuperConstrainedClass(CombGuid.Generate());

			for (int i = 0; i < iterations; i++)
			{
				var obj = FastActivator.Create(typeof(ClassWithAConstrainedGenericArgument<,>), argument);
			}
		}
Exemplo n.º 5
0
		public void GenericArgumentConstructor(int iterations)
		{
			var argument = new SuperConstrainedClass(CombGuid.Generate());
			Type type = typeof(ClassWithAConstrainedGenericArgument<,>).MakeGenericType(typeof(SuperConstrainedClass),
			                                                                            typeof(Guid));

			for (int i = 0; i < iterations; i++)
			{
				var obj = Activator.CreateInstance(type, argument);
			}
		}
Exemplo n.º 6
0
        public void GenericArgumentConstructor(int iterations)
        {
            var  argument = new SuperConstrainedClass(CombGuid.Generate());
            Type type     = typeof(ClassWithAConstrainedGenericArgument <,>).MakeGenericType(typeof(SuperConstrainedClass),
                                                                                             typeof(Guid));

            for (int i = 0; i < iterations; i++)
            {
                var obj = Activator.CreateInstance(type, argument);
            }
        }
Exemplo n.º 7
0
        public void An_object_matching_the_constraint_should_properly_define_the_generic_type_with_deep()
        {
            Guid id = CombGuid.Generate();

            var argument = new SuperConstrainedClass(id);

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

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

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

            instance.Value.ShouldEqual(argument);
        }
Exemplo n.º 8
0
        public void An_object_with_multiple_constraints_should_be_created()
        {
            Guid id       = CombGuid.Generate();
            var  argument = new SuperConstrainedClass(id);

            string name      = "Name";
            var    argument2 = new ClassWithStringConstraint(name);

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

            obj.ShouldNotBeNull();
            obj.ShouldBeAnInstanceOf <ClassWithTwoConstrainedGenericArguments <SuperConstrainedClass, Guid, ClassWithStringConstraint, string> >();

            var instance = (ClassWithTwoConstrainedGenericArguments <SuperConstrainedClass, Guid, ClassWithStringConstraint, string>)obj;

            instance.Value.ShouldEqual(argument);
            instance.Value2.ShouldEqual(argument2);
        }
Exemplo n.º 9
0
		public void An_object_matching_the_constraint_should_properly_define_the_generic_type_with_deep()
		{
			Guid id = CombGuid.Generate();

			var argument = new SuperConstrainedClass(id);

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

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

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

			instance.Value.ShouldEqual(argument);
		}
Exemplo n.º 10
0
		public void An_object_with_multiple_constraints_should_be_created()
		{
			Guid id = CombGuid.Generate();
			var argument = new SuperConstrainedClass(id);

			string name = "Name";
			var argument2 = new ClassWithStringConstraint(name);

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

			obj.ShouldNotBeNull();
			obj.ShouldBeAnInstanceOf<ClassWithTwoConstrainedGenericArguments<SuperConstrainedClass, Guid, ClassWithStringConstraint, string>>();

			var instance = (ClassWithTwoConstrainedGenericArguments<SuperConstrainedClass, Guid, ClassWithStringConstraint, string>) obj;

			instance.Value.ShouldEqual(argument);
			instance.Value2.ShouldEqual(argument2);
		}