Beispiel #1
0
        public void ParametersHaveCorrectPositionOrderWithinCatagory()
        {
            IParameterCatagory <BasicOptions> catagory = ArgumentParser.Create("app").CreateParameterCatagory <BasicOptions>();

            IParameter <BasicOptions, string> firstParameter  = catagory.WithParameter(x => x.String);
            IParameter <BasicOptions, int>    secondParameter = catagory.WithParameter(x => x.Integer);

            Assert.Equal(1000u, catagory.PositionStart);
            Assert.Equal(1000u, firstParameter.Position);
            Assert.Equal(1001u, secondParameter.Position);
        }
Beispiel #2
0
        public void ParameterCanCreateParameterCatagory()
        {
            ArgumentParser parser = ArgumentParser.Create("app");

            IParameterCatagory <BasicOptions> firstCatagory          = parser.CreateParameterCatagory <BasicOptions>();
            IParameter <BasicOptions, string> firstCatagoryParameter = firstCatagory.WithParameter(x => x.String);

            IParameterCatagory <BasicOptions> secondCatagory          = firstCatagoryParameter.CreateParameterCatagory <BasicOptions>();
            IParameter <BasicOptions, string> secondCatagoryParameter = secondCatagory.WithParameter(x => x.String);

            Assert.NotSame(firstCatagory, secondCatagory);
            Assert.NotSame(firstCatagoryParameter, secondCatagoryParameter);
        }
Beispiel #3
0
        public void ParametersHaveCorrectPositionOrderBetweenCatagories()
        {
            ArgumentParser parser = ArgumentParser.Create("app");
            IParameterCatagory <BasicOptions> firstCatagory  = parser.CreateParameterCatagory <BasicOptions>();
            IParameterCatagory <BasicOptions> secondCatagory = parser.CreateParameterCatagory <BasicOptions>();

            IParameter <BasicOptions, string> firstCatagoryParameter  = firstCatagory.WithParameter(x => x.String);
            IParameter <BasicOptions, int>    secondCatagoryParameter = secondCatagory.WithParameter(x => x.Integer);

            Assert.Equal(1000u, firstCatagory.PositionStart);
            Assert.Equal(2000u, secondCatagory.PositionStart);
            Assert.Equal(1000u, firstCatagoryParameter.Position);
            Assert.Equal(2000u, secondCatagoryParameter.Position);
        }
Beispiel #4
0
 public IParameter <TArgumentOptions, TArgument1> WithParameter <TArgument1>(Expression <Func <TArgumentOptions, TArgument1> > argument)
 {
     return(_currentCatagory.WithParameter(argument));
 }
        public void ParameterCatagoryWithCatagoryOnSamePropertyThrowArgumentException()
        {
            IParameterCatagory <BasicOptions> catagory = ArgumentParser.Create("app").CreateParameterCatagory <BasicOptions>();

            Assert.Throws <ArgumentException>(() => catagory.WithParameter(x => x.Boolean).WithParameter(x => x.Boolean));
        }
        public void ParameterCatagoryWithCatagoryIsTypeIParameter_T_()
        {
            IParameterCatagory <BasicOptions> catagory = ArgumentParser.Create("app").CreateParameterCatagory <BasicOptions>();

            Assert.IsAssignableFrom <IParameter <BasicOptions, bool> >(catagory.WithParameter(x => x.Boolean));
        }
        public void ParameterCatagoryWithCatagoryNotNull()
        {
            IParameterCatagory <BasicOptions> catagory = ArgumentParser.Create("app").CreateParameterCatagory <BasicOptions>();

            Assert.NotNull(catagory.WithParameter(x => x.Boolean));
        }