示例#1
0
        public void ClassArgument()
        {
            var person = new ClassTests.Person(MondValue.Object(), "Rohan");

            var personValue = MondValue.Object(_state);

            personValue.UserData = person;

            _state["rohan"] = personValue;

            Assert.True(_state.Run(@"
                return global.Greet(global.rohan);
            ") == "hello Rohan!");

            personValue.UserData = "something";

            Assert.Throws <MondRuntimeException>(() => _state.Run(@"
                global.Greet(global.rohan);
            "));

            personValue.UserData = null;

            Assert.Throws <MondRuntimeException>(() => _state.Run(@"
                global.Greet(global.rohan);
            "));
        }
示例#2
0
 public static string Greet(ClassTests.Person person)
 {
     return(person.GenerateGreeting());
 }