示例#1
0
        public void get_Status()
        {
            var ex = new ResultException(5);

            Assert.Equal(5, ex.Status);
            Assert.Equal("错误 5", ex.Message);
        }
示例#2
0
        public void get_Message()
        {
            var ex = new ResultException("test");

            Assert.Equal(ResultStatus.Failed, ex.Status);
            Assert.Equal("test", ex.Message);
        }
示例#3
0
        public void ToCustomResultT()
        {
            var ex = new ResultException(5);
            var r  = ex.ToCustomResult <Result <Uri> >();

            Assert.Equal(5, r.Status);
            Assert.Equal("错误 5", r.Message);
            Assert.Equal(ex, r.Exception);
        }
示例#4
0
        public void ToResult()
        {
            var ex = new ResultException(5);
            var r  = ex.ToResult();

            Assert.Equal(5, r.Status);
            Assert.Equal("错误 5", r.Message);
            Assert.Equal(ex, r.Exception);
        }
示例#5
0
        public void Constructor_String_Int32()
        {
            var message = "test";
            var status  = 5;
            var ex      = new ResultException(message, status);

            Assert.Equal(message, ex.Message);
            Assert.Equal(status, ex.Status);
            Assert.Throws <ArgumentOutOfRangeException>(() => new ResultException("", 0));
        }