Exemplo n.º 1
0
        public void CreateReferenceWithWrongDelimiterAndGetValues_Failing(ArgumentConstructor type, string config, string[] arguments)
        {
            Argument a = CreateConstructor_Passing(type, config, arguments, schema);

            ArgumentException ex = Assert.Throws <ArgumentException>(() => a.GetValue <object>(arguments[1].Substring(2).ToString()).ToString());

            Assert.Equal(ErrorCode.INVALID_PARAMETER, ex.ErrorCode);
            Assert.Null(ex.ErrorArgumentId);
            Assert.Equal(arguments[1].Substring(2).ToString(), ex.ErrorParameter);
            Assert.Equal($"'{arguments[1].Substring(2).ToString()}' is not a valid parameter", ex.ErrorMessage());
        }
Exemplo n.º 2
0
        public void CreateReferenceWithEmptyDelimiterAndGetValues_Failing()
        {
            foreach (ArgumentConstructor constructor in GetConstructorTypes())
            {
                Argument a;

                ArgumentException ex = Assert.Throws <ArgumentException>(() => a = CreateConstructor_Passing(constructor, configEmptyDelimiter, args[0].Take(4).Select(x => x.Replace("-", "/")).ToArray(), schema.Take(2)));

                Assert.Equal(ErrorCode.INVALID_PARAMETER, ex.ErrorCode);
                Assert.Equal(args[0][0].Replace("-", "/"), ex.ErrorParameter);
                Assert.Equal($"'{args[0][0].Replace("-", "/")}' is not a valid parameter", ex.ErrorMessage());
            }
        }