Beispiel #1
0
 public bool Equals(ClassWithStringConstraint other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Id, Id));
 }
Beispiel #2
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);
        }
Beispiel #3
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);
		}