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");
        }
Exemple #2
0
        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);
    }
Exemple #4
0
 private void Start()
 {
     DontDestroyOnLoad(this);
     if (PhotonNetwork.IsConnected)
     {
         return;
     }
     MyCustomType.Register();
     PhotonNetwork.ConnectUsingSettings();
 }
Exemple #5
0
            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);
            }
Exemple #6
0
 void PrintCustom(MyCustomType custom)
 {
     Debug.Log(custom.test1 + " : " + custom.test2 + " : " + custom.test3 + " : " + custom.test4);
 }
Exemple #7
0
 public void ChangeValue(MyCustomType input)
 {
     Value = input;
 }
Exemple #8
0
 static void Parse(string str, out MyCustomType val)
 {
     val = new MyCustomType(str);
 }