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); } }
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); } }
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); } }
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); } }
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); }
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); }
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); }
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); }