static T Create <T, P>(P value) { if (typeof(T).Equals(typeof(FamilyMember)) && typeof(P).Equals(typeof(FamilyRelation))) { FamilyRelation rel = Identity <FamilyRelation, P> .Cast(value); return((T)(object)new FamilyMember(rel)); } throw new NotImplementedException(); }
public void Cast_returns_appropriate_identity() { var identity = new Identity <long, Animal>(5); Assert.That(() => Identity.Cast <Cat>(identity).Value, Is.EqualTo(5)); }