public void CastInternalCastFromMyType() { GrainReference grain = (GrainReference)this.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix); // This cast should be a no-op, since the interface matches the initial reference's exactly. IAddressable cast = grain.Cast <ISimpleGrain>(); Assert.Same(grain, cast); Assert.IsAssignableFrom <ISimpleGrain>(cast); }
public void CastInternalCastUpFromChild() { // GeneratorTestDerivedGrain1Reference extends GeneratorTestGrainReference GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <IGeneratorTestDerivedGrain1>(GetRandomGrainId()); // This cast should be a no-op, since the interface is implemented by the initial reference's interface. IAddressable cast = grain.Cast <IGeneratorTestGrain>(); Assert.Same(grain, cast); Assert.IsAssignableFrom <IGeneratorTestGrain>(cast); }