示例#1
0
        public void BasicActivation_ULong_MaxValue()
        {
            ulong key1AsUlong = UInt64.MaxValue; // == -1L
            long  key1        = (long)key1AsUlong;

            ITestGrain g1 = GrainClient.GrainFactory.GetGrain <ITestGrain>(key1);

            Assert.Equal(key1, g1.GetPrimaryKeyLong());
            Assert.Equal((long)key1AsUlong, g1.GetPrimaryKeyLong());
            Assert.Equal(key1, g1.GetKey().Result);
            Assert.Equal(key1.ToString(CultureInfo.InvariantCulture), g1.GetLabel().Result);

            g1.SetLabel("MaxValue").Wait();
            Assert.Equal("MaxValue", g1.GetLabel().Result);

            ITestGrain g1a = GrainClient.GrainFactory.GetGrain <ITestGrain>((long)key1AsUlong);

            Assert.Equal("MaxValue", g1a.GetLabel().Result);
            Assert.Equal(key1, g1a.GetPrimaryKeyLong());
            Assert.Equal((long)key1AsUlong, g1a.GetKey().Result);
        }
示例#2
0
        public void BasicActivation_Long_MinValue()
        {
            long  key1        = Int64.MinValue;
            ulong key1AsUlong = (ulong)key1;

            ITestGrain g1 = this.GrainFactory.GetGrain <ITestGrain>(key1);

            Assert.Equal((long)key1AsUlong, g1.GetPrimaryKeyLong());
            Assert.Equal(key1, g1.GetPrimaryKeyLong());
            Assert.Equal(key1, g1.GetKey().Result);
            Assert.Equal(key1.ToString(CultureInfo.InvariantCulture), g1.GetLabel().Result);

            g1.SetLabel("MinValue").Wait();
            Assert.Equal("MinValue", g1.GetLabel().Result);

            ITestGrain g1a = this.GrainFactory.GetGrain <ITestGrain>((long)key1AsUlong);

            Assert.Equal("MinValue", g1a.GetLabel().Result);
            Assert.Equal(key1, g1a.GetPrimaryKeyLong());
            Assert.Equal((long)key1AsUlong, g1a.GetKey().Result);
        }
示例#3
0
        public void BasicActivation_ActivateAndUpdate()
        {
            ITestGrain g1 = GrainClient.GrainFactory.GetGrain <ITestGrain>(1);
            ITestGrain g2 = GrainClient.GrainFactory.GetGrain <ITestGrain>(2);

            Assert.AreEqual(1L, g1.GetPrimaryKeyLong());
            Assert.AreEqual(1L, g1.GetKey().Result);
            Assert.AreEqual("1", g1.GetLabel().Result);
            Assert.AreEqual(2L, g2.GetKey().Result);
            Assert.AreEqual("2", g2.GetLabel().Result);

            g1.SetLabel("one").Wait();
            Assert.AreEqual("one", g1.GetLabel().Result);
            Assert.AreEqual("2", g2.GetLabel().Result);

            ITestGrain g1a = GrainClient.GrainFactory.GetGrain <ITestGrain>(1);

            Assert.AreEqual("one", g1a.GetLabel().Result);
        }
示例#4
0
        public void BasicActivation_ActivateAndUpdate()
        {
            long       g1Key = GetRandomGrainId();
            long       g2Key = GetRandomGrainId();
            ITestGrain g1    = GrainClient.GrainFactory.GetGrain <ITestGrain>(g1Key);
            ITestGrain g2    = GrainClient.GrainFactory.GetGrain <ITestGrain>(g2Key);

            Assert.Equal(g1Key, g1.GetPrimaryKeyLong());
            Assert.Equal(g1Key, g1.GetKey().Result);
            Assert.Equal(g1Key.ToString(), g1.GetLabel().Result);
            Assert.Equal(g2Key, g2.GetKey().Result);
            Assert.Equal(g2Key.ToString(), g2.GetLabel().Result);

            g1.SetLabel("one").Wait();
            Assert.Equal("one", g1.GetLabel().Result);
            Assert.Equal(g2Key.ToString(), g2.GetLabel().Result);

            ITestGrain g1a = GrainClient.GrainFactory.GetGrain <ITestGrain>(g1Key);

            Assert.Equal("one", g1a.GetLabel().Result);
        }