public void Custom_types_and_conversion_logic_can_be_specified() { var argument = new Argument <MyCustomType>((SymbolResult parsed, out MyCustomType value) => { var custom = new MyCustomType(); foreach (var a in parsed.Arguments) { custom.Add(a); } value = custom; return(true); }) { Arity = ArgumentArity.ZeroOrMore, Name = "arg" }; var parser = new Parser( new Command("custom", "", argument: argument)); var result = parser.Parse("custom one two three"); var customType = result.CommandResult .GetArgumentValueOrDefault <MyCustomType>("arg"); customType .Values .Should() .BeEquivalentTo("one", "two", "three"); }
public void Custom_types_and_conversion_logic_can_be_specified() { var argument = new Argument <MyCustomType>(parsed => { var custom = new MyCustomType(); foreach (var a in parsed.Arguments) { custom.Add(a); } return(ArgumentResult.Success(custom)); }) { Arity = ArgumentArity.ZeroOrMore }; var parser = new Parser( new Command("custom", "", argument: argument)); var result = parser.Parse("custom one two three"); var customType = result.CommandResult.GetValueOrDefault <MyCustomType>(); customType .Values .Should() .BeEquivalentTo("one", "two", "three"); }
static void Main(string[] args) { MyCustomType c = new MyCustomType(); c.Description = string.Format("Something like this {0}", (char)22); var output = c.ToXMLString(); Console.WriteLine(output); }
private void Start() { DontDestroyOnLoad(this); if (PhotonNetwork.IsConnected) { return; } MyCustomType.Register(); PhotonNetwork.ConnectUsingSettings(); }
public void should_return_the_last_instance_it_was_set_as_an_alias_for() { MyCustomType differentInstance = new MyCustomType(); _builder.AliasFor(_existingInstance); _builder.AliasFor(differentInstance); var result = _builder.build(); result.Should().BeSameAs(differentInstance); }
void PrintCustom(MyCustomType custom) { Debug.Log(custom.test1 + " : " + custom.test2 + " : " + custom.test3 + " : " + custom.test4); }
public void ChangeValue(MyCustomType input) { Value = input; }
static void Parse(string str, out MyCustomType val) { val = new MyCustomType(str); }