public void CastCheckExpectedCompatIds() { Type t = typeof(ISimpleGrain); int expectedInterfaceId = GrainInterfaceData.GetGrainInterfaceId(t); GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix); Assert.IsTrue(grain.IsCompatible(expectedInterfaceId)); }
public void CastFailInternalCastFromBadType() { Type t = typeof(ISimpleGrain); GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix); IAddressable cast = GrainReference.CastInternal( typeof(Boolean), null, grain, GrainInterfaceData.GetGrainInterfaceId(t)); Assert.Fail("Exception should have been raised"); }
public void CastCheckExpectedCompatIds2() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); int id1 = GrainInterfaceData.GetGrainInterfaceId(t1); int id2 = GrainInterfaceData.GetGrainInterfaceId(t2); int id3 = GrainInterfaceData.GetGrainInterfaceId(t3); GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <IGeneratorTestDerivedDerivedGrain>(GetRandomGrainId()); Assert.IsTrue(grain.IsCompatible(id1)); Assert.IsTrue(grain.IsCompatible(id2)); Assert.IsTrue(grain.IsCompatible(id3)); }
public void ConfirmServiceInterfacesListContents() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); int id1 = GrainInterfaceData.GetGrainInterfaceId(t1); int id2 = GrainInterfaceData.GetGrainInterfaceId(t2); int id3 = GrainInterfaceData.GetGrainInterfaceId(t3); var interfaces = GrainInterfaceData.GetRemoteInterfaces(typeof(IGeneratorTestDerivedDerivedGrain)); Assert.IsNotNull(interfaces); Assert.AreEqual(3, interfaces.Keys.Count); Assert.IsTrue(interfaces.Keys.Contains(id1), "id1 is present"); Assert.IsTrue(interfaces.Keys.Contains(id2), "id2 is present"); Assert.IsTrue(interfaces.Keys.Contains(id3), "id3 is present"); }