Exemplo n.º 1
0
        public void MinimalSerializationAndDeserialization()
        {
            var argumentBag             = ArgumentBags.MinArgumentBag;
            var json                    = argumentBag.ToJson(true);
            var deserializedArgumentBag = ArgumentBag.FromJson(json);

            Assert.IsNotNull(deserializedArgumentBag);
        }
Exemplo n.º 2
0
        internal static string Prefix(this ArgumentBag bag, string property)
        {
            var info         = bag.GetType().GetProperty(property);
            var claAttribute =
                (CommandLineArgumentAttribute)info.GetCustomAttribute(typeof(CommandLineArgumentAttribute));

            if (claAttribute == null)
            {
                return(string.Empty);
            }
            return(claAttribute.Name + claAttribute.Seperator.GetType()
                   .GetRuntimeField(claAttribute.Seperator.ToString())
                   .GetCustomAttributes(typeof(EnumMemberAttribute), true)
                   .Select(a => ((EnumMemberAttribute)a).Value).FirstOrDefault());
        }
Exemplo n.º 3
0
        public void CreateAsOneLiner()
        {
            var argumentBag = new ArgumentBag("-reset");

            Assert.That(argumentBag.ToString() == "-reset");
        }