public async Task SiloSayHelloArchiveTest()
        {
            long         id        = new Random().Next();
            const string greeting1 = "Bonjour";
            const string greeting2 = "Hei";

            IHelloArchive grain = GrainFactory.GetGrain <IHelloArchive>(id);

            // This will directly call the grain under test.
            await grain.SayHello(greeting1);

            await grain.SayHello(greeting2);

            var greetings = (await grain.GetGreetings()).ToList();

            Assert.Contains(greeting1, greetings);
            Assert.Contains(greeting2, greetings);
        }
Beispiel #2
0
        public async Task SiloSayHelloArchiveTest()
        {
            // The mocked Orleans runtime is already set up at this point

            const long   id        = 0;
            const string greeting1 = "Bonjour";
            const string greeting2 = "Hei";

            IHelloArchive grain = GrainFactory.GetGrain <IHelloArchive>(id);

            // This will directly call the grain under test.
            await grain.SayHello(greeting1);

            await grain.SayHello(greeting2);

            var greetings = (await grain.GetGreetings()).ToList();

            Assert.True(greetings.Contains(greeting1));
            Assert.True(greetings.Contains(greeting2));
        }
        public async void NonSiloSayHelloArchiveTest()
        {
            // The mocked Orleans runtime is already set up at this point

            const long   id        = 0;
            const string greeting1 = "Bonjour";
            const string greeting2 = "Hei";

            //Create a new instance of the grain. Notice this is the concrete grain type
            //that is being tested, not just the grain interface as with the silo test
            IHelloArchive grain = TestGrainFactory.CreateGrain <HelloArchiveGrain>(id);

            // This will directly call the grain under test.
            await grain.SayHello(greeting1);

            await grain.SayHello(greeting2);

            var greetings = (await grain.GetGreetings()).ToList();

            Assert.True(greetings.Contains(greeting1));
            Assert.True(greetings.Contains(greeting2));
        }