Пример #1
0
        public void TextColumn()
        {
            Grid grid = new Grid();

            Text column = new Text("column", grid.MasterTable);

            column.Required   = true;
            column.Primarykey = true;
            Text column2 = new Text("column2", grid.MasterTable);

            column2.IsEmail = true;

            Text column3 = new Text("column3", grid.MasterTable);

            column3.IsEmail = true;

            Text column4 = new Text("column4", grid.MasterTable);

            column4.IsUrl    = true;
            column4.Required = true;

            Text column5 = new Text("column5", grid.MasterTable);

            column.IsPassword = true;

            Text column6 = new Text("column6", grid.MasterTable);
            Text column7 = new Text("column7", grid.MasterTable);
            Text column8 = new Text("column8", grid.MasterTable);

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);
            grid.MasterTable.Columns.Add(column3);
            grid.MasterTable.Columns.Add(column4);
            grid.MasterTable.Columns.Add(column5);
            grid.MasterTable.Columns.Add(column6);
            grid.MasterTable.Columns.Add(column7);
            grid.MasterTable.Columns.Add(column8);

            SetupGrid(grid);
            // Not allowed content
            grid.MasterTable.Rows[0]["column"].Value  = "";
            grid.MasterTable.Rows[0]["column4"].Value = "";
            grid.MasterTable.Rows[0]["column3"].Value = "invalid@email";

            // Allowed Content
            grid.MasterTable.Rows[0]["column2"].Value = "*****@*****.**";
            grid.MasterTable.Rows[0]["column5"].Value = "somepassword";
            grid.MasterTable.Rows[0]["column6"].Value = "<validtext>";
            grid.MasterTable.Rows[0]["column7"].Value = "<%valid text%>";
            grid.MasterTable.Rows[0]["column8"].Value = "valid text";

            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);
            grid.RaisePostBackEvent("RecordUpdateClick!!False");

            Assert.AreSame("", grid.MasterTable.Rows[0]["column"].Value.ToString());
            Assert.AreSame("", grid.MasterTable.Rows[0]["column4"].Value.ToString());
            Assert.AreSame("invalid@email", grid.MasterTable.Rows[0]["column3"].Value.ToString());

            Assert.AreEqual(grid.SystemMessage.Count, 3);
        }
Пример #2
0
        public void TextColumn()
        {
            Grid grid = new Grid();

            Text column = new Text("column", grid.MasterTable);
            column.Required = true;
            column.Primarykey = true;
            Text column2 = new Text("column2", grid.MasterTable);
            column2.IsEmail = true;

            Text column3 = new Text("column3", grid.MasterTable);
            column3.IsEmail = true;

            Text column4 = new Text("column4", grid.MasterTable);
            column4.IsUrl = true;
            column4.Required = true;

            Text column5 = new Text("column5", grid.MasterTable);
            column.IsPassword = true;

            Text column6 = new Text("column6", grid.MasterTable);
            Text column7 = new Text("column7", grid.MasterTable);
            Text column8 = new Text("column8", grid.MasterTable);

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);
            grid.MasterTable.Columns.Add(column3);
            grid.MasterTable.Columns.Add(column4);
            grid.MasterTable.Columns.Add(column5);
            grid.MasterTable.Columns.Add(column6);
            grid.MasterTable.Columns.Add(column7);
            grid.MasterTable.Columns.Add(column8);

            SetupGrid(grid);
            // Not allowed content
            grid.MasterTable.Rows[0]["column"].Value = "";
            grid.MasterTable.Rows[0]["column4"].Value = "";
            grid.MasterTable.Rows[0]["column3"].Value = "invalid@email";

            // Allowed Content
            grid.MasterTable.Rows[0]["column2"].Value = "*****@*****.**";
            grid.MasterTable.Rows[0]["column5"].Value = "somepassword";
            grid.MasterTable.Rows[0]["column6"].Value = "<validtext>";
            grid.MasterTable.Rows[0]["column7"].Value = "<%valid text%>";
            grid.MasterTable.Rows[0]["column8"].Value = "valid text";

            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);
            grid.RaisePostBackEvent("RecordUpdateClick!!False");

            Assert.AreSame("", grid.MasterTable.Rows[0]["column"].Value.ToString());
            Assert.AreSame("", grid.MasterTable.Rows[0]["column4"].Value.ToString());
            Assert.AreSame("invalid@email", grid.MasterTable.Rows[0]["column3"].Value.ToString());

            Assert.AreEqual(grid.SystemMessage.Count, 3);
        }