예제 #1
0
        public void SerializeDeserializeMachineWithNativeBehavior()
        {
            Machine machine = new Machine();
            IBehavior behavior = machine.CreateNativeBehavior(null, typeof(System.IO.File));
            machine.RegisterNativeBehavior(typeof(System.IO.File), (NativeBehavior)behavior);
            machine.SetGlobalObject("File", behavior);

            var result = this.Process(machine, machine);

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(Machine));

            var newmachine = (Machine)result;

            Assert.IsNotNull(newmachine.GetGlobalObject("File"));
            Assert.IsNotNull(newmachine.GetNativeBehavior(typeof(System.IO.File)));
        }