public void CastCheckExpectedCompatIds() { Type t = typeof(ISimpleGrain); int expectedInterfaceId = GrainInterfaceUtils.GetGrainInterfaceId(t); GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix); Assert.True(grain.IsCompatible(expectedInterfaceId)); }
public void CastCheckExpectedCompatIds2() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); int id1 = GrainInterfaceUtils.GetGrainInterfaceId(t1); int id2 = GrainInterfaceUtils.GetGrainInterfaceId(t2); int id3 = GrainInterfaceUtils.GetGrainInterfaceId(t3); GrainReference grain = (GrainReference)this.GrainFactory.GetGrain <IGeneratorTestDerivedDerivedGrain>(GetRandomGrainId()); }
public void CastFailInternalCastFromBadType() { Xunit.Assert.Throws <InvalidCastException>(() => { Type t = typeof(ISimpleGrain); GrainReference grain = (GrainReference)GrainClient.GrainFactory.GetGrain <ISimpleGrain>(random.Next(), SimpleGrain.SimpleGrainNamePrefix); IAddressable cast = GrainReference.CastInternal( typeof(Boolean), null, grain, GrainInterfaceUtils.GetGrainInterfaceId(t)); Assert.Fail("Exception should have been raised"); }); }
public void ConfirmServiceInterfacesListContents() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); var interfaces = GrainInterfaceUtils.GetRemoteInterfaces(typeof(IGeneratorTestDerivedDerivedGrain)); Assert.NotNull(interfaces); Assert.Equal(3, interfaces.Count); Assert.Contains(t1, interfaces); Assert.Contains(t2, interfaces); Assert.Contains(t3, interfaces); }
public void CastCheckExpectedCompatIds2() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); int id1 = GrainInterfaceUtils.GetGrainInterfaceId(t1); int id2 = GrainInterfaceUtils.GetGrainInterfaceId(t2); int id3 = GrainInterfaceUtils.GetGrainInterfaceId(t3); Assert.Equal(-692645356, id1); Assert.Equal(-342583538, id2); Assert.Equal(-712890543, id3); GrainReference grain = (GrainReference)this.GrainFactory.GetGrain <IGeneratorTestDerivedDerivedGrain>(GetRandomGrainId()); Assert.NotNull(grain); }
public void ConfirmServiceInterfacesListContents() { // GeneratorTestDerivedDerivedGrainReference extends GeneratorTestDerivedGrain2Reference // GeneratorTestDerivedGrain2Reference extends GeneratorTestGrainReference Type t1 = typeof(IGeneratorTestDerivedDerivedGrain); Type t2 = typeof(IGeneratorTestDerivedGrain2); Type t3 = typeof(IGeneratorTestGrain); int id1 = GrainInterfaceUtils.GetGrainInterfaceId(t1); int id2 = GrainInterfaceUtils.GetGrainInterfaceId(t2); int id3 = GrainInterfaceUtils.GetGrainInterfaceId(t3); var interfaces = GrainInterfaceUtils.GetRemoteInterfaces(typeof(IGeneratorTestDerivedDerivedGrain)); Assert.NotNull(interfaces); Assert.Equal(3, interfaces.Keys.Count); Assert.True(interfaces.Keys.Contains(id1), "id1 is present"); Assert.True(interfaces.Keys.Contains(id2), "id2 is present"); Assert.True(interfaces.Keys.Contains(id3), "id3 is present"); }
public void InterfaceRules_ObserverGrain_PropertySetter() { Xunit.Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_PropertySetter))); }
public void InterfaceRules_RefArgument() { Xunit.Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(ITestGrain_RefArgument))); }
public void InterfaceRules_Observer_Property() { Xunit.Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(ITestObserver_Property))); }
public void InterfaceRules_IntMethod() { Xunit.Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(ITestGrain_IntMethod))); }
public void InterfaceRules_ObserverGrain_IntMethod() { Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(IInheritedGrain_ObserverGrain_IntMethod))); }
public void InterfaceRules_Observer_NonVoidMethod() { Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(ITestObserver_NonVoidMethod))); }
public void InterfaceRules_PropertySetter() { Assert.Throws <GrainInterfaceUtils.RulesViolationException>(() => GrainInterfaceUtils.ValidateInterface(typeof(ITestGrain_PropertySetter))); }
public void InterfaceRules_ValueTask() { GrainInterfaceUtils.ValidateInterface(typeof(ITestGrain_ValueTask)); }