Exemplo n.º 1
0
        public void CollectionTest_GrainId_TypeCode()
        {
            var g1Key = GetRandomGrainId();
            ICollectionTestGrain g1  = this.GrainFactory.GetGrain <ICollectionTestGrain>(g1Key);
            LegacyGrainId        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"
        }