コード例 #1
0
        public void TestUseByReferenceTypeAfterRestart()
        {
            using (var logCollector = new LogCollector(new [] { "SharpRemote.EndPoints.ProxyStorage" }, new [] { Level.Debug }))
                using (var silo = new SharpRemote.Hosting.OutOfProcessSilo(failureHandler: new RestartOnFailureStrategy()))
                {
                    logCollector.AutoPrint(TestContext.Progress);
                    silo.Start();

                    var factory = silo.CreateGrain <IAdvancedFactory>(typeof(AdvancedFactory));
                    var proxyToByReferenceClass = factory.Create(typeof(ByReferenceClass));
                    var id = GetIdOf(proxyToByReferenceClass);
                    Console.WriteLine("ObjectId: {0}", id);

                    RestartHost(silo);

                    factory = silo.CreateGrain <IAdvancedFactory>(typeof(AdvancedFactory));
                    var proxyToObject = factory.Create(typeof(Handle));
                    var otherId       = GetIdOf(proxyToObject);
                    Console.WriteLine("ObjectId: {0}", otherId);
                }
        }