Example #1
0
        public void CreateException_FailingTest()
        {
            ArgumentsException ex = new DoubleArgumentMarshaler.DoubleMarshalerException(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 DoubleArgumentMarshaler.DoubleMarshalerException(ErrorCode.MISSING);

            ex.ErrorArgumentId = this.testArgument;

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

            Assert.Equal($"Could not find double parameter for -{this.testArgument}", ex.ErrorMessage());
        }
Example #3
0
        public void CreateExceptionWithErrorCodeAndParameter_PassingTest()
        {
            ArgumentsException ex = new DoubleArgumentMarshaler.DoubleMarshalerException(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 double but was '{this.testParameter}'", ex.ErrorMessage());
        }