public void TestRotate_FontAwesome() { var attributes = new TagHelperAttributeList { { UiConst.Rotate, RotateType.Rotate180 }, { UiConst.FontAwesomeIcon, FontAwesomeIcon.Android } }; var result = new String(); result.Append("<i class=\"fa-rotate-180 fa fa-android\"></i>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestId() { var attributes = new TagHelperAttributeList { { UiConst.Id, "a" } }; var result = new String(); result.Append("<ng-template #a=\"\"></ng-template>"); Assert.Equal(result.ToString(), GetResult(attributes)); }
public void TestIconSize_FontAwesome() { var attributes = new TagHelperAttributeList { { UiConst.Size, IconSize.Large2X }, { UiConst.FontAwesomeIcon, FontAwesomeIcon.Android } }; var result = new String(); result.Append("<i class=\"fa-2x fa fa-android\"></i>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestIconSize_Material() { var attributes = new TagHelperAttributeList { { UiConst.Size, IconSize.Large2X }, { UiConst.MaterialIcon, MaterialIcon.Android } }; var result = new String(); result.Append("<mat-icon class=\"fa-2x\">android</mat-icon>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestId() { var attributes = new TagHelperAttributeList { { "id", "a" }, { UiConst.FontAwesomeIcon, FontAwesomeIcon.Android } }; var result = new String(); result.Append("<i class=\"fa fa-android\" id=\"a\"></i>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestMaterialIcon() { var attributes = new TagHelperAttributeList { { UiConst.MaterialIcon, MaterialIcon.Android } }; var result = new String(); result.Append("<mat-icon>android</mat-icon>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestOn_11() { //结果 var result = new String(); result.Append("Join [Sample] As [t] "); result.AppendLine("On [a].[id]=[b].[id] "); result.Append("Join [Sample2] As [t2] "); result.Append("On [t].[ShortValue]>[t2].[IntValue] Or [t].[DisplayValue]=[t2].[StringValue]"); //操作 _clause.Join <Sample>("t"); _clause.On("a.id", "b.id"); _clause.Join <Sample2>("t2"); _clause.On <Sample, Sample2>((l, r) => l.ShortValue > r.IntValue || l.DisplayValue == r.StringValue); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestSpin_Material() { var attributes = new TagHelperAttributeList { { UiConst.Spin, true }, { Util.Ui.Configs.UiConst.MaterialIcon, MaterialIcon.Android } }; var result = new String(); result.Append("<mat-icon class=\"fa-spin\">android</mat-icon>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestOn_7() { //结果 var result = new String(); result.Append("Join [Sample] As [t] "); result.AppendLine("On [a].[id]=[b].[id] "); result.Append("Join [Sample2] As [t2] "); result.Append("On [t].[BoolValue]<[t2].[IntValue]"); //操作 _clause.Join <Sample>("t"); _clause.On("a.id", "b.id"); _clause.Join <Sample2>("t2"); _clause.On <Sample, Sample2>(t => t.BoolValue, t => t.IntValue, Operator.Less); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestOn_8() { //结果 var result = new String(); result.Append("Join [Sample] "); result.AppendLine("On [a].[id]=[b].[id] "); result.Append("Join [Sample2] "); result.Append("On [Sample].[ShortValue]>[Sample2].[IntValue]"); //操作 _clause.Join <Sample>(); _clause.On("a.id", "b.id"); _clause.Join <Sample2>(); _clause.On <Sample, Sample2>((l, r) => l.ShortValue > r.IntValue); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestOn_14() { //结果 var result = new String(); result.Append("Join [Sample] As [t] "); result.AppendLine("On [a].[id]=@_p_0 "); result.Append("Join [Sample2] As [t2] "); result.Append("On [t].[ShortValue]>[t2].[IntValue] And @_p_1=[t].[IntValue]"); //操作 _clause.Join <Sample>("t"); _clause.On("a.id", "b.id"); _clause.Join <Sample2>("t2"); _clause.On <Sample, Sample2>((l, r) => l.ShortValue > r.IntValue && 1 == l.IntValue); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestSpin_FontAwesome_False() { var attributes = new TagHelperAttributeList { { UiConst.Spin, false }, { Util.Ui.Configs.UiConst.FontAwesomeIcon, FontAwesomeIcon.Android } }; var result = new String(); result.Append("<i class=\"fa fa-android\"></i>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestRotate_Material() { var attributes = new TagHelperAttributeList { { UiConst.Rotate, RotateType.Rotate180 }, { UiConst.MaterialIcon, MaterialIcon.Android } }; var result = new String(); result.Append("<mat-icon class=\"fa-rotate-180\">android</mat-icon>"); Assert.Equal(result.ToString(), GetResult(_icon, attributes)); }
public void TestTemplateId() { var config = new ColumnShareConfig(new TableShareConfig("id"), "a"); var items = new Dictionary <object, object> { { typeof(ColumnShareConfig), config } }; var result = new String(); result.Append("<ng-template #id_edit_a=\"\"></ng-template>"); Assert.Equal(result.ToString(), GetResult(items: items)); }
public void TestAddCDataNode_3() { //结果 var result = new String(); result.Append("<xml>"); result.Append("<a>"); result.Append("<![CDATA[1]]>"); result.Append("</a>"); result.Append("</xml>"); //操作 _xml.AddCDataNode("1", "a"); //验证 Assert.Equal(result.ToString(), _xml.ToString()); //输出结果 _output.WriteLine(_xml.ToString()); }
public void TestOn_13() { //结果 var result = new String(); result.Append("Join [Sample] As [t] "); result.AppendLine("On [a].[id]=@_p_0 "); result.Append("Join [Sample2] As [t2] "); result.Append("On [t].[ShortValue]>[t2].[IntValue] And [t].[IntValue]=@_p_1"); //操作 _clause.Join <Sample>("t"); _clause.On("a.id", "b"); _clause.Join <Sample2>("t2"); _clause.On <Sample, Sample2>((l, r) => l.ShortValue > r.IntValue && l.IntValue == 1); //验证 Assert.Equal(result.ToString(), GetSql()); Assert.Equal("b", _parameterManager.GetParams()["@_p_0"]); Assert.Equal(1, _parameterManager.GetParams()["@_p_1"]); }
public void TestAppendOn_2() { //结果 var result = new String(); result.Append("Join [t] "); result.AppendLine("On [a].[id]=@_p_0 And a.id=b.id "); result.Append("Join [v] "); result.Append("On [v].[id]=@_p_1 And v.id=b.id"); //操作 _clause.Join("t"); _clause.On("a.id", "b"); _clause.AppendOn("a.id=b.id"); _clause.Join("v"); _clause.On("v.id", "c"); _clause.AppendOn("v.id=b.id"); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestOn_4() { //结果 var result = new String(); result.Append("Join [t] "); result.AppendLine("On [a].[id]=@_p_0 And [c].[Aid]=@_p_1 "); result.Append("Join [n] "); result.Append("On [t].[id]=@_p_2 And [t].[Aid]=@_p_3"); //操作 _clause.Join("t"); _clause.On("a.id", "b"); _clause.On("c.Aid", "d"); _clause.Join("n"); _clause.On("t.id", "e"); _clause.On("t.Aid", "f"); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestOn_4() { //结果 var result = new String(); result.Append("Join [t] "); result.AppendLine("On [a].[id]=[b].[id] And [c].[Aid]=[d].[Bid] "); result.Append("Join [n] "); result.Append("On [t].[id]=[n].[id] And [t].[Aid]=[n].[Bid]"); //操作 _clause.Join("t"); _clause.On("a.id", "b.id"); _clause.On("c.Aid", "d.Bid"); _clause.Join("n"); _clause.On("t.id", "n.id"); _clause.On("t.Aid", "n.Bid"); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void Test_3() { var result = new String(); result.Append("<td>"); result.Append("<ng-container *ngIf=\"editTableId.editId !== row.id;else templateId\" "); result.Append("nz-tooltip=\"\" [nzTitle]=\"(row.a|isTruncate:3)?row.a:''\">"); result.Append("{{row.a|truncate:3}}"); result.Append("</ng-container>"); result.Append("<ng-template #templateId=\"\">"); result.Append("content"); result.Append("</ng-template>"); result.Append("</td>"); _builder = new TextEditColumnBuilder("editTableId", "templateId", "a", 3, _content); _builder.Init(); Assert.Equal(result.ToString(), _builder.ToString()); }
public void TestAttribute() { var contextAttributes = new TagHelperAttributeList { { UiConst.FontAwesomeIcon, FontAwesomeIcon.Android } }; var outputAttributes = new TagHelperAttributeList { { "a", "1" } }; var result = new String(); result.Append("<i a=\"1\" class=\"fa fa-android\"></i>"); Assert.Equal(result.ToString(), GetResult(contextAttributes, outputAttributes)); }
public void TestStyle() { var contextAttributes = new TagHelperAttributeList { { UiConst.MaterialIcon, MaterialIcon.Android } }; var outputAttributes = new TagHelperAttributeList { { "style", "a" } }; var result = new String(); result.Append("<mat-icon style=\"a\">android</mat-icon>"); Assert.Equal(result.ToString(), GetResult(contextAttributes, outputAttributes)); }
public void TestAddNode_2() { //结果 var result = new String(); result.Append("<xml>"); result.Append("<a>"); result.Append("<b>2</b>"); result.Append("</a>"); result.Append("</xml>"); //操作 var parent = _xml.AddNode("a"); _xml.AddNode("b", "2", parent); //验证 Assert.Equal(result.ToString(), _xml.ToString()); //输出结果 _output.WriteLine(_xml.ToString()); }
public void TestFrom_4() { //结果 var result = new String(); result.AppendLine("Select * "); result.Append("From "); result.AppendLine("(Select Count(*) "); result.AppendLine("From [Test2] "); result.AppendLine("Where [Name]=@_p_0) As [test] "); result.Append("Where [Age]=@_p_1"); //执行 _builder.From(builder => builder.Count().From("Test2").Where("Name", "a"), "test").Where("Age", 1); _output.WriteLine(_builder.ToSql()); //验证 Assert.Equal(result.ToString(), _builder.ToSql()); Assert.Equal(2, _builder.GetParams().Count); Assert.Equal("a", _builder.GetParams()["@_p_0"]); Assert.Equal(1, _builder.GetParams()["@_p_1"]); }
public void Test() { var builder = new MasterCheckBoxBuilder("a", "b"); var result = new String(); result.Append("<label "); result.Append("(nzCheckedChange)=\"a.masterToggle()\" "); result.Append("*ngIf=\"a.showCheckbox\" "); result.Append("nz-checkbox=\"\" "); result.Append("[nzChecked]=\"a.isMasterChecked()\" "); result.Append("[nzIndeterminate]=\"a.isMasterIndeterminate()\">"); result.Append("b"); result.Append("</label>"); Assert.Equal(result.ToString(), builder.ToString()); }
public void Test() { var builder = new CheckBoxBuilder("a", "b"); var result = new String(); result.Append("<label "); result.Append("(nzCheckedChange)=\"a.toggle(row)\" "); result.Append("*ngIf=\"a.isShowCheckbox()\" "); result.Append("nz-checkbox=\"\" "); result.Append("[nzChecked]=\"a.isChecked(row)\" "); result.Append("[nzIndeterminate]=\"a.isIndeterminate(row)\">"); result.Append("{{b}}"); result.Append("</label>"); Assert.Equal(result.ToString(), builder.ToString()); }
public void TestSelect_7() { //结果 var result = new String(); result.Append("Select *,"); result.AppendLine("(Select Count(*) "); result.AppendLine("From [Test2] "); result.AppendLine("Where [Name]=@_p_0) As testCount "); result.AppendLine("From [Test] "); result.Append("Where [Age]=@_p_1"); //执行 var builder2 = _builder.New().Count().From("Test2").Where("Name", "a"); _builder.Select("*").AppendSelect("(").Select(builder2, "").AppendSelect(") As testCount").From("Test").Where("Age", 1); //验证 Assert.Equal(result.ToString(), _builder.ToSql()); Assert.Equal(2, _builder.GetParams().Count); Assert.Equal("a", _builder.GetParams()["@_p_0"]); Assert.Equal(1, _builder.GetParams()["@_p_1"]); }
public void Test_2() { //结果 var result = new String(); result.AppendLine("Select `c` "); result.Append("From `a.b`"); //执行 _builder.Select("c").From("a.b"); //验证 Assert.Equal(result.ToString(), _builder.ToSql()); }
public void TestRightJoin_4() { //结果 var result = new String(); result.AppendLine("Join a "); result.Append("Right Join b"); //操作 _clause.AppendJoin("a"); _clause.AppendRightJoin("b"); //验证 Assert.Equal(result.ToString(), GetSql()); }
public void TestJoin_8() { //结果 var result = new String(); result.AppendLine("Join [a] "); result.Append("Join [b]"); //操作 _clause.Join("a"); _clause.Join("b"); //验证 Assert.Equal(result.ToString(), GetSql()); }