Пример #1
0
        public void CreateExceptionWithErrorCodeAndParameter_PassingTest(ErrorCode code, string argument, string parameter, string message)
        {
            BaseArgumentException ex = new ArgumentException(code, parameter);

            ex.ErrorArgumentId = argument;

            Assert.Equal(code, ex.ErrorCode);

            if (argument == null)
            {
                Assert.Null(ex.ErrorArgumentId);
            }
            else
            {
                Assert.Equal(argument, ex.ErrorArgumentId);
            }

            if (parameter == null)
            {
                Assert.Null(ex.ErrorParameter);
            }
            else
            {
                Assert.Equal(parameter, ex.ErrorParameter);
            }

            Assert.Equal(message, ex.Message);
            Assert.Equal(message, ex.ErrorMessage());
        }
Пример #2
0
        public void CreateReference_Failing(string file, IEnumerable <string> arguments, RaGae.ArgumentLib.MarshalerLib.ErrorCode errorCode, string message)
        {
            List <string> a = new List <string>()
            {
                file
            };

            arguments.ToList().ForEach(e => a.Add(e));

            TemplateUpdateModel u = null;

            ArgumentException ex = Assert.Throws <ArgumentException>(() => u = new TemplateUpdateModel(a));

            Assert.Null(u);
            Assert.Equal(errorCode, ex.ErrorCode);
            Assert.Equal(message, ex.Message);
            Assert.Equal(message, ex.ErrorMessage());
        }