public void CollectionTest_GrainId_TypeCode() { ICollectionTestGrain g1 = GrainClient.GrainFactory.GetGrain <ICollectionTestGrain>(1); GrainId id1 = ((GrainReference)g1).GrainId; UniqueKey k1 = id1.Key; Console.WriteLine("GrainId={0} UniqueKey={1} PK={2} KeyType={3} IdCategory={4}", id1, k1, id1.GetPrimaryKeyLong(), k1.IdCategory, k1.BaseTypeCode); Assert.IsTrue(id1.IsGrain, "GrainReference should be for a grain"); Assert.AreEqual(UniqueKey.Category.Grain, k1.IdCategory, "GrainId should be for self-managed type"); Assert.AreEqual(1, k1.PrimaryKeyToLong(), "Encoded primary key should match"); Assert.AreEqual(1381240679, k1.BaseTypeCode, "Encoded type code data should match"); }
public void CollectionTest_GrainId_TypeCode() { var g1Key = GetRandomGrainId(); ICollectionTestGrain g1 = this.GrainFactory.GetGrain <ICollectionTestGrain>(g1Key); GrainId id1 = ((GrainReference)g1).GrainId; UniqueKey k1 = id1.Key; output.WriteLine("GrainId={0} UniqueKey={1} PK={2} KeyType={3} IdCategory={4}", id1, k1, id1.GetPrimaryKeyLong(), k1.IdCategory, k1.BaseTypeCode); Assert.True(id1.IsGrain, "GrainReference should be for a grain"); Assert.Equal(UniqueKey.Category.Grain, k1.IdCategory); // "GrainId should be for self-managed type" Assert.Equal(g1Key, k1.PrimaryKeyToLong()); // "Encoded primary key should match" Assert.Equal(1381240679, k1.BaseTypeCode); // "Encoded type code data should match" }