public void TestImageTypes_Jpg()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.ImageTypes, new List <ImageType> {
                      ImageType.Jpg
                  } }
            };
            var result = new String();

            result.Append("<x-upload accept=\".jpg,.jpeg\">");
            result.Append("</x-upload>");
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #2
0
        public void TestDefault()
        {
            var result = new String();

            result.Append("<nz-table-wrapper #m_id_wrapper=\"\">");
            result.Append("<nz-table #m_id=\"\" [nzData]=\"m_id_wrapper.dataSource\" [nzTotal]=\"m_id_wrapper.totalCount\">");
            result.Append("<tbody>");
            result.Append("<tr *ngFor=\"let row of m_id.data\">");
            result.Append("</tr>");
            result.Append("</tbody>");
            result.Append("</nz-table>");
            result.Append("</nz-table-wrapper>");
            Assert.Equal(result.ToString(), GetResult());
        }
예제 #3
0
 /// <summary>
 /// 添加表格BodyHtml
 /// </summary>
 private void AppendTableBodyHtml(String result)
 {
     result.Append("<tbody>");
     result.Append("<ng-container *ngFor=\"let row of m_id.data\">");
     result.Append("<tr *ngIf=\"m_id_wrapper.isShow(row)\">");
     result.Append("</tr>");
     result.Append("</ng-container>");
     result.Append("</tbody>");
     result.Append("</nz-table>");
     result.Append("<ng-template #template_m_id=\"\" let-range=\"range\" let-total=\"\">");
     result.Append(TableConfig.TotalTemplate);
     result.Append("</ng-template>");
     result.Append("</nz-tree-table-wrapper>");
 }
예제 #4
0
        public void TestFrom_5()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.Append("From [b].[Sample] As [a]");

            //执行
            _builder.From <Sample>("a", "b");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #5
0
        public void TestOnExpand()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.OnExpand, "a" }
            };
            var result = new String();

            result.Append("<nz-tree-table-wrapper #m_id_wrapper=\"\" (onExpand)=\"a\">");
            result.Append("<nz-table #m_id=\"\" (nzPageIndexChange)=\"m_id_wrapper.pageIndexChange($event)\" (nzPageSizeChange)=\"m_id_wrapper.pageSizeChange($event)\" ");
            result.Append("[nzData]=\"m_id_wrapper.dataSource\" [nzFrontPagination]=\"false\" [nzLoading]=\"m_id_wrapper.loading\" [nzShowPagination]=\"m_id_wrapper.showPagination\" ");
            result.Append("[nzShowQuickJumper]=\"true\" [nzShowSizeChanger]=\"true\" [nzShowTotal]=\"template_m_id\" [nzTotal]=\"m_id_wrapper.totalCount\">");
            AppendTableBodyHtml(result);
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #6
0
        public void TestSelect_4()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [t].[a],[b] ");
            result.Append("From [c] As [d]");

            //执行
            _builder.Select("t.a,[b]").From("c", "d");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #7
0
        public void TestSelect_2()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a] ");
            result.Append("From [b] As [c]");

            //执行
            _builder.Select("a").From("b", "c");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #8
0
        public void TestSelect_5()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [Email],[IntValue] ");
            result.Append("From [b]");

            //执行
            _builder.Select <Sample>(t => new object[] { t.Email, t.IntValue }).From("b");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #9
0
        public void TestSelect_6()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [j].[a],[j].[b],[k].[c],[k].[d] ");
            result.Append("From [e]");

            //执行
            _builder.Select("a,b", "j").Select("c,d", "k").From("e");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #10
0
        public void TestSelect_7()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a].*,[b].* ");
            result.Append("From [c]");

            //执行
            _builder.Select("a.*,b.*").From("c");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #11
0
        public void TestFrom_4()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.Append("From [a].[b] As [t]");

            //执行
            _builder.From("a.b as t");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #12
0
        public void TestFrom_3()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.Append("From [c].[a] As [b]");

            //执行
            _builder.From("c.a", "b");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #13
0
        public void TestDefault()
        {
            var result = new String();

            result.Append("<nz-upload-wrapper #m_id=\"\">");
            result.Append("<nz-upload (nzChange)=\"m_id.handleChange($event)\" [(nzFileList)]=\"m_id.files\" [nzFilter]=\"m_id.filters\">");
            result.Append("<x-button text=\"上传\">");
            result.Append("<ng-template>");
            result.Append("<i nz-icon=\"\" nzType=\"upload\"></i>");
            result.Append("</ng-template>");
            result.Append("</x-button>");
            result.Append("</nz-upload>");
            result.Append("</nz-upload-wrapper>");
            Assert.Equal(result.ToString(), GetResult());
        }
예제 #14
0
        public void TestSelect_10()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [Sample_Email],[Sample_IntValue] ");
            result.Append("From [b]");

            //执行
            _builder = new SqlServerBuilder(new TestEntityMatedata());
            _builder.Select <Sample>(t => new object[] { t.Email, t.IntValue }).From("b");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #15
0
        public void TestKey()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.Key, "a" }
            };
            var result = new String();

            result.Append("<mat-table-wrapper #m_id=\"\" key=\"a\">");
            result.Append("<mat-table matSort=\"\" matSortDisableClear=\"\" [dataSource]=\"m_id.dataSource\" ");
            result.Append("[style.max-height]=\"m_id.maxHeight?m_id.maxHeight+'px':null\" ");
            result.Append("[style.min-height]=\"m_id.minHeight?m_id.minHeight+'px':null\">");
            result.Append("</mat-table>");
            result.Append("</mat-table-wrapper>");
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #16
0
 /// <summary>
 /// 获取结果
 /// </summary>
 private string GetResult()
 {
     Util.Helpers.String result = new Util.Helpers.String();
     result.Append("app_id=2016090800463464&");
     result.Append("biz_content=%7b%22out_trade_no%22%3a%2259f7caeeab89e009e4a4e1fb%22%2c%22subject%22%3a%22test%22%2c%22total_amount%22%3a%2210%22%2c%22timeout_express%22%3a%2290m%22%7d&");
     result.Append("charset=utf-8&");
     result.Append("format=json&");
     result.Append("method=alipay.trade.app.pay&");
     result.Append("notify_url=b&");
     result.Append("sign=mOSS0X%2bSCJwF8lTRyFjkb0539vPBdZljlvA2oOIAX7THS5RdLYGVPRA5y3vs%2froCalG8%2fJpGWgCbzYGMIRySWnwdLnNBY%2fXXS1x%2fM0hfRheOECxe%2bCppjhCHHbSp6Deavval7nsMSQ27HJSLtD5MbjXk6U49Pja4TyIWheXN6nF4Rv8T0fsuCAtxvcV%2fWxQMjAochsLO9YSj610aA%2f72qnHCqOOnV4zLT6xCR3LxcK6j4oJ%2f0SKITd5hvBuH29mLpoLUSl2QQ8XcabRCxxoZG5dbsAmvqxq3VFEk%2fU9Yc%2fCE%2bDpyBsDLF0d9Hi3I17EsLC5BIPxLLNKeJtcJL5DYoA%3d%3d&");
     result.Append("sign_type=RSA2&");
     result.Append("timestamp=2000-10-10+10%3a10%3a10&");
     result.Append("version=1.0");
     return(result.ToString());
 }
예제 #17
0
        public void TestSelect_8()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a].[Email],[a].[IntValue],[b].[Description],[b].[Display] ");
            result.Append("From [b]");

            //执行
            _builder.Select <Sample>(t => new object[] { t.Email, t.IntValue }, "a")
            .Select <Sample2>(t => new object[] { t.Description, t.Display }, "b")
            .From("b");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #18
0
 /// <summary>
 /// 获取结果
 /// </summary>
 private string GetResult()
 {
     Util.Helpers.String result = new Util.Helpers.String();
     result.Append("app_id=2016090800463464&");
     result.Append("biz_content=%7b%22out_trade_no%22%3a%2259f7caeeab89e009e4a4e1fb%22%2c%22subject%22%3a%22test%22%2c%22total_amount%22%3a%2210%22%2c%22timeout_express%22%3a%2290m%22%7d&");
     result.Append("charset=utf-8&");
     result.Append("format=json&");
     result.Append("method=alipay.trade.app.pay&");
     result.Append("notify_url=b&");
     result.Append("return_url=a&");
     result.Append("sign=Qo2CG5r%2fz4h2vQySXP78ZsFMYZuogJ8RyzNPXwAu74TDcgZ9P27S37DAz2pgvTnE%2b%2bB6wESsUX8RYpyePTTO40fSDQzcTrfwoltImEFK7iVrY1OlmCRvoH6FVaZoXaypKH1ZOLMf0%2fSofzsI7OVrcdA58YcGvJbBLM8ppfzLDIKT10rwQa33D7WlSbHFb0iYJM7RPPhpY%2b5fkgFQo7CnknBPW9zOr7AoLTlAxJ%2fD5veYzjmaKMR5yaFAYvgBxMpJCeSlDMgiWMb7iNy5Ila7CvjG1A51eB5NAkhtodnajRsexMKyy5hG%2f3bU7efSJeDBQdehRkKIilZH5uNGivr5Ng%3d%3d&");
     result.Append("sign_type=RSA2&");
     result.Append("timestamp=2018-05-22+11%3a11%3a11&");
     result.Append("version=1.0");
     return(result.ToString());
 }
예제 #19
0
        public void TestDefault()
        {
            var result = new String();

            result.Append("<nz-table-wrapper #m_id_wrapper=\"\">");
            result.Append("<nz-table #m_id=\"\" (nzPageIndexChange)=\"m_id_wrapper.pageIndexChange($event)\" (nzPageSizeChange)=\"m_id_wrapper.pageSizeChange($event)\" ");
            result.Append("[nzData]=\"m_id_wrapper.dataSource\" [nzFrontPagination]=\"false\" [nzLoading]=\"m_id_wrapper.loading\" [nzShowPagination]=\"m_id_wrapper.showPagination\" ");
            result.Append("[nzShowSizeChanger]=\"true\" [nzTotal]=\"m_id_wrapper.totalCount\">");
            result.Append("<tbody>");
            result.Append("<tr *ngFor=\"let row of m_id.data\">");
            result.Append("</tr>");
            result.Append("</tbody>");
            result.Append("</nz-table>");
            result.Append("</nz-table-wrapper>");
            Assert.Equal(result.ToString(), GetResult());
        }
예제 #20
0
 /// <summary>
 /// 获取结果
 /// </summary>
 private string GetResult()
 {
     Util.Helpers.String result = new Util.Helpers.String();
     result.Append("app_id=2016090800463464&");
     result.Append("biz_content={\"out_trade_no\":\"59f7caeeab89e009e4a4e1fb\",\"subject\":\"test\",\"total_amount\":\"10\",\"timeout_express\":\"90m\"}&");
     result.Append("charset=utf-8&");
     result.Append("format=json&");
     result.Append("method=alipay.trade.app.pay&");
     result.Append("notify_url=b&");
     result.Append("return_url=a&");
     result.Append("sign=ppnaNEdqch5JmMTWHgcThsXAMQ7qOFuMirAZhOBCjtvn8h3gcAd2HaGlV/5fL60X3ExWgmifeqbP2uOteIOG2+OZju3whhCkugk2IZZXQ82pf1ZMR1FnF660PyUPyvZdbQJ85wsNkWWnkWCIJlCXWblNlYrxSB5zitlVTWoUYwe98VI76/zGUTa/ZAaD2fXGNh8Ov4aZd2GRhzeTpfKrMWrp7GeGbQi5hzouhkqyi3kZQrNldc0O2HCWpKJq4gxL/aF+6KbUkvdHZzsvWlc35fLRv4P7TnQqxkVrV96+1U4b+0WtMrevSardJKG0hdo7A4IHJJdxxP9qdo2xxKcm7Q==&");
     result.Append("sign_type=RSA2&");
     result.Append("timestamp=2017-10-31 08:59:26&");
     result.Append("version=1.0");
     return(result.ToString());
 }
예제 #21
0
        public void Test_1()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a3].[a],[a1].[b1],[a2].[b2] ");
            result.AppendLine("From [b] As [a2] ");
            result.Append("Join [c] As [a3] On [a2].[d]=[a3].[e]");

            //执行
            _builder.Select("a,a1.b1,[a2].[b2]", "a3")
            .From("b", "a2")
            .Join("c", "a3").On("a2.d", "a3.[e]");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #22
0
        public void Test_27()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a].[Email] ");
            result.AppendLine("From [Sample] As [a] ");
            result.Append("Where ([a].[Email] Is Null Or [a].[Email]='')");

            //执行
            _builder.Select <Sample>(t => t.Email)
            .From <Sample>("a")
            .IsEmpty("a.Email");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #23
0
        public void Test_30()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a].[Email] ");
            result.AppendLine("From [Sample] As [a] ");
            result.Append("Where [a].[Email] Is Not Null And [a].[Email]<>''");

            //执行
            _builder.Select <Sample>(t => t.Email)
            .From <Sample>("a")
            .IsNotEmpty <Sample>(t => t.Email);

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #24
0
        public void Test_34()
        {
            //结果
            var result = new String();

            result.AppendLine("Select [a].[Email] ");
            result.AppendLine("From [Sample] As [a] ");
            result.Append("Group By [a].[B],[c].[D]");

            //执行
            _builder.Select <Sample>(t => t.Email)
            .From <Sample>("a")
            .GroupBy("a.B,c.[D]");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #25
0
        public void TestScrollWidth_Number()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.ScrollWidth, "100" }
            };
            var result = new String();

            result.Append("<nz-table-wrapper #m_id_wrapper=\"\">");
            result.Append("<nz-table #m_id=\"\" (nzPageIndexChange)=\"m_id_wrapper.pageIndexChange($event)\" (nzPageSizeChange)=\"m_id_wrapper.pageSizeChange($event)\" ");
            result.Append("[(nzPageIndex)]=\"m_id_wrapper.queryParam.page\" [(nzPageSize)]=\"m_id_wrapper.queryParam.pageSize\" ");
            result.Append("[nzData]=\"m_id_wrapper.dataSource\" [nzFrontPagination]=\"false\" ");
            result.Append("[nzLoading]=\"m_id_wrapper.loading\" [nzScroll]=\"{'x':'100px'}\" [nzShowPagination]=\"m_id_wrapper.showPagination\" ");
            result.Append("[nzShowQuickJumper]=\"true\" [nzShowSizeChanger]=\"true\" ");
            result.Append("[nzShowTotal]=\"template_m_id\" [nzTotal]=\"m_id_wrapper.totalCount\">");
            AppendTableBodyHtml(result);
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #26
0
        public void TestQueryParam()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.QueryParam, "a" }
            };
            var result = new String();

            result.Append("<nz-table-wrapper #m_id_wrapper=\"\" [(queryParam)]=\"a\">");
            result.Append("<nz-table #m_id=\"\" [nzData]=\"m_id_wrapper.dataSource\" [nzTotal]=\"m_id_wrapper.totalCount\">");
            result.Append("<tbody>");
            result.Append("<tr *ngFor=\"let row of m_id.data\">");
            result.Append("</tr>");
            result.Append("</tbody>");
            result.Append("</nz-table>");
            result.Append("</nz-table-wrapper>");
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #27
0
        public void TestId()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.Id, "a" }
            };
            var result = new String();

            result.Append("<nz-table-wrapper #a_wrapper=\"\">");
            result.Append("<nz-table #a=\"\" [nzData]=\"a_wrapper.dataSource\" [nzShowPagination]=\"a_wrapper.showPagination\" ");
            result.Append("[nzTotal]=\"a_wrapper.totalCount\">");
            result.Append("<tbody>");
            result.Append("<tr *ngFor=\"let row of a.data\">");
            result.Append("</tr>");
            result.Append("</tbody>");
            result.Append("</nz-table>");
            result.Append("</nz-table-wrapper>");
            Assert.Equal(result.ToString(), GetResult(attributes));
        }
예제 #28
0
        public void TestWhere_19()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.AppendLine("From [Sample] As [k] ");
            result.Append("Where [k].[Email]=@_p__0 And [k].[StringValue] Like @_p__1");

            //执行
            _builder.From <Sample>("k").Where <Sample>(t => t.Email == "a" && t.StringValue.Contains("b"));

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
            Assert.Equal(2, _builder.GetParams().Count);
            Assert.Equal("a", _builder.GetParams()["@_p__0"]);
            Assert.Equal("%b%", _builder.GetParams()["@_p__1"]);
        }
예제 #29
0
        public void TestWhere_21()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.AppendLine("From [Sample] As [k] ");
            result.Append("Where ([o].[Email]=@_p__0 And [o].[StringValue] Like @_p__1 Or [o].[IntValue]=@_p__2) ");
            result.Append("And ([p].[Email]=@_p__3 Or [p].[IntValue]=@_p__4)");

            //执行
            _builder.From <Sample>("k")
            .Where <Sample>(t => t.Email == "a" && t.StringValue.Contains("b") || t.IntValue == 1, "o")
            .Where <Sample>(t => t.Email == "c" || t.IntValue == 2, "p");

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
        }
예제 #30
0
        public void TestUrl()
        {
            var attributes = new TagHelperAttributeList {
                { UiConst.Url, "a" }
            };
            var result = new String();

            result.Append("<nz-upload-wrapper #m_id=\"\">");
            result.Append("<nz-upload (nzChange)=\"m_id.handleChange($event)\" nzAction=\"a\" [(nzFileList)]=\"m_id.files\" [nzFilter]=\"m_id.filters\">");
            result.Append("<x-button text=\"上传\">");
            result.Append("<ng-template>");
            result.Append("<i nz-icon=\"\" nzType=\"upload\"></i>");
            result.Append("</ng-template>");
            result.Append("</x-button>");
            result.Append("</nz-upload>");
            result.Append("</nz-upload-wrapper>");
            Assert.Equal(result.ToString(), GetResult(attributes));
        }