Esempio n. 1
0
        protected async Task Grain_LongKeyExtended_AzureStore_Read_Write()
        {
            long   id     = random.Next();
            string extKey = random.Next().ToString(CultureInfo.InvariantCulture);

            IAzureStorageTestGrain_LongExtendedKey
                grain = this.GrainFactory.GetGrain <IAzureStorageTestGrain_LongExtendedKey>(id, extKey, null);

            int val = await grain.GetValue();

            Assert.Equal(0, val);   // "Initial value"

            await grain.DoWrite(1);

            val = await grain.GetValue();

            Assert.Equal(1, val);   // "Value after Write-1"

            await grain.DoWrite(2);

            val = await grain.GetValue();

            Assert.Equal(2, val);   // "Value after Write-2"

            val = await grain.DoRead();

            Assert.Equal(2, val);   // "Value after DoRead"

            val = await grain.GetValue();

            Assert.Equal(2, val);   // "Value after Re-Read"

            string extKeyValue = await grain.GetExtendedKeyValue();

            Assert.Equal(extKey, extKeyValue);   // "Extended Key"
        }
        public async Task Grain_LongKeyExtended_AzureStore_Read_Write()
        {
            long   id     = random.Next();
            string extKey = random.Next().ToString(CultureInfo.InvariantCulture);

            IAzureStorageTestGrain_LongExtendedKey
                grain = GrainClient.GrainFactory.GetGrain <IAzureStorageTestGrain_LongExtendedKey>(id, extKey, null);

            int val = await grain.GetValue();

            Assert.AreEqual(0, val, "Initial value");

            await grain.DoWrite(1);

            val = await grain.GetValue();

            Assert.AreEqual(1, val, "Value after Write-1");

            await grain.DoWrite(2);

            val = await grain.GetValue();

            Assert.AreEqual(2, val, "Value after Write-2");

            val = await grain.DoRead();

            Assert.AreEqual(2, val, "Value after DoRead");

            val = await grain.GetValue();

            Assert.AreEqual(2, val, "Value after Re-Read");

            string extKeyValue = await grain.GetExtendedKeyValue();

            Assert.AreEqual(extKey, extKeyValue, "Extended Key");
        }