コード例 #1
0
ファイル: ActorTests.cs プロジェクト: yonglehou/Daytona
 public void WriteAndReadReadfromPersistenceTest()
 {
     using (var actor = new Actor<Order>())
     {
         var order = new Order();
         order.Description = "John's new order";
         actor.PersistSelf(typeof(Order), order, new DefaultSerializer(Pipe.ControlChannelEncoding));
         actor.PersistanceSerializer = new DefaultSerializer(Pipe.ControlChannelEncoding);
         var returnedOrder = actor.ReadfromPersistence(@"TestHelpers.Order");
         Assert.AreEqual(order.Description, returnedOrder.Description);
     }
 }
コード例 #2
0
ファイル: ActorTests.cs プロジェクト: yonglehou/Daytona
        public void PersistSelfTest()
        {
            using (var context = NetMQContext.Create())
            {
                using (var exchange = new Exchange(context))
                {
                    exchange.Start();

                    using (var actor = new Actor<Customer>(context))
                    {
                        var customer = new Customer(1);
                        customer.Firstname = "John";
                        customer.Lastname = "off yer Rocker mate";

                        actor.PersistSelf(typeof(Customer), customer, new DefaultSerializer(Pipe.ControlChannelEncoding));
                    }
                    
                    exchange.Stop(true);
                }
            }
        }