コード例 #1
0
 public IGrammar UsingObjectIs()
 {
     return CreateObject<Location>("The location is", _ =>
     {
         _.ObjectIs = c => new Location {X = Context.State.Retrieve<int>()};
         _.SetProperty(x => x.Y);
         _.Do(location => _location = location);
     });
 }
コード例 #2
0
 public void LoadLocation()
 {
     _location = new Location();
     Context.State.CurrentObject = _location;
 }
コード例 #3
0
 public IGrammar AllProps()
 {
     return CreateNewObject<Location>("The location is", _ =>
     {
         _.SetAllPrimitivePropertiesSpecificToThisType();
         _.Do(x => _location = x);
     });
 }
コード例 #4
0
        public IGrammar UsingWithInput()
        {
            return CreateNewObject<Location>("The location is", _ =>
            {
                _.WithInput<string>("data is {data}").Configure((location, data) =>
                {
                    var parts = data.Split(';');

                    location.X = int.Parse(parts.First());
                    location.Y = int.Parse(parts.Last());
                }).DefaultValue("1;2");

                _.Do(x => _location = x);
            });
        }