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");
        }
示例#5
0
 public void InterfaceRules_ObserverGrain_PropertySetter()
 {
     GrainInterfaceData.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_PropertySetter));
 }
示例#6
0
 public void InterfaceRules_ObserverGrain_IntMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_IntMethod));
 }
示例#7
0
 public void InterfaceRules_RefArgument()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_RefArgument));
 }
示例#8
0
 public void InterfaceRules_Observer_Property()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestObserver_Property));
 }
示例#9
0
 public void InterfaceRules_Observer_NonVoidMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestObserver_NonVoidMethod));
 }
示例#10
0
 public void InterfaceRules_PropertySetter()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_PropertySetter));
 }
示例#11
0
 public void InterfaceRules_IntProperty()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_IntProperty));
 }
示例#12
0
 public void InterfaceRules_IntMethod()
 {
     GrainInterfaceData.ValidateInterface(typeof(ITestGrain_IntMethod));
 }