Example #1
0
        public void CreateException_FailingTest()
        {
            ArgumentsException ex = new IntegerArgumentMarshaler.IntegerMarshalerException(ErrorCode.OK);

            Assert.Null(ex.ErrorArgumentId);
            Assert.Null(ex.ErrorParameter);

            Assert.Equal(string.Empty, ex.ErrorMessage());
        }
Example #2
0
        public void CreateExceptionWithErrorCode_PassingTest()
        {
            ArgumentsException ex = new IntegerArgumentMarshaler.IntegerMarshalerException(ErrorCode.MISSING);

            ex.ErrorArgumentId = this.testArgument;

            Assert.Equal(this.testArgument, ex.ErrorArgumentId);
            Assert.Null(ex.ErrorParameter);

            Assert.Equal($"Could not find integer parameter for -{this.testArgument}", ex.ErrorMessage());
        }
Example #3
0
        public void CreateExceptionWithErrorCodeAndParameter_PassingTest()
        {
            ArgumentsException ex = new IntegerArgumentMarshaler.IntegerMarshalerException(ErrorCode.INVALID, this.testParameter);

            ex.ErrorArgumentId = this.testArgument;

            Assert.Equal(this.testArgument, ex.ErrorArgumentId);
            Assert.Equal(this.testParameter, ex.ErrorParameter);

            Assert.Equal($"Argument -{this.testArgument} expects an integer but was '{this.testParameter}'", ex.ErrorMessage());
        }