public void InvalidCastingThrowsException() { IQuantity <double> quantity = (Meter)10.0; // The following is a valid conversion: Yard yards = (Yard)(Meter)quantity; Assert.AreEqual((Yard)10.936132983377078, yards, "Meter-to-Yard conversion failed"); // ... and the following is a valid conversion: yards = Yard.From(quantity); Assert.AreEqual((Yard)10.936132983377078, yards, "IQuantity-to-Yard conversion failed"); // ... but the following fails at runtime throwing InvalidCastException: Specified cast is not valid var badCast = (Yard)quantity; }