Beispiel #1
0
        public void ID_Interning_GrainID()
        {
            Guid    guid = new Guid();
            GrainId gid1 = GrainId.FromParsableString(guid.ToString("B"));
            GrainId gid2 = GrainId.FromParsableString(guid.ToString("N"));

            Assert.Equal(gid1, gid2); // Should be equal GrainId's
            Assert.Same(gid1, gid2);  // Should be same / intern'ed GrainId object

            // Round-trip through Serializer
            GrainId gid3 = (GrainId)SerializationManager.RoundTripSerializationForTesting(gid1);

            Assert.Equal(gid1, gid3); // Should be equal GrainId's
            Assert.Equal(gid2, gid3); // Should be equal GrainId's
            Assert.Same(gid1, gid3);  // Should be same / intern'ed GrainId object
            Assert.Same(gid2, gid3);  // Should be same / intern'ed GrainId object
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new grain and a grain reference pair.
 /// </summary>
 /// <param name="grainId">The grain ID.</param>
 /// <param name="version">The initial version of the state.</param>
 /// <returns>A grain reference and a state pair.</returns>
 internal Tuple <GrainReference, GrainState <TestState1> > GetTestReferenceAndState(string grainId, string version)
 {
     return(Tuple.Create(this.grainFactory.GetGrain(GrainId.FromParsableString(GrainId.GetGrainId(RandomUtilities.NormalGrainTypeCode, grainId).ToParsableString())), new GrainState <TestState1> {
         State = new TestState1(), ETag = version
     }));
 }