예제 #1
0
        public void ImageField_GetDesignTimeValue()
        {
            PokerImageField field  = new PokerImageField();
            string          result = field.DoGetDesignTimeValue();

            Assert.AreEqual("Databound", result, "GetDesignTimeValue");
        }
예제 #2
0
        public void ImageField_CopyProperties()
        {
            PokerImageField field = new PokerImageField();
            ImageField      copy  = new ImageField();

            field.AlternateText                 = "test";
            field.ConvertEmptyStringToNull      = true;
            field.DataAlternateTextField        = "test";
            field.DataAlternateTextFormatString = "test";
            field.DataImageUrlField             = "test";
            field.DataImageUrlFormatString      = "test";
            field.NullDisplayText               = "test";
            field.NullImageUrl = "test";
            field.ReadOnly     = true;

            field.DoCopyProperties(copy);
            Assert.AreEqual("test", copy.AlternateText, "AlternateText");
            Assert.AreEqual(true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
            Assert.AreEqual("test", copy.DataAlternateTextField, "DataAlternateTextField");
            Assert.AreEqual("test", copy.DataImageUrlField, "DataImageUrlField");
            Assert.AreEqual("test", copy.DataAlternateTextFormatString, "DataAlternateTextFormatString");
            Assert.AreEqual("test", copy.DataImageUrlField, "DataImageUrlField");
            Assert.AreEqual("test", copy.DataImageUrlFormatString, "DataImageUrlFormatString");
            Assert.AreEqual("test", copy.NullDisplayText, "NullDisplayText");
            Assert.AreEqual("test", copy.NullImageUrl, "NullImageUrl");
            Assert.AreEqual(true, copy.ReadOnly, "ReadOnly");
        }
예제 #3
0
        public void ImageField_FormatDataNavigateUrlValue()
        {
            PokerImageField field  = new PokerImageField();
            string          result = field.DoFormatImageUrlValue(null);

            Assert.AreEqual(null, result, "DoFormatImageUrlValueEmpty");
            field.DataImageUrlFormatString = "-{0,8:G}-";
            result = field.DoFormatImageUrlValue(10);
            Assert.AreEqual("-      10-", result, "FormatImageUrlValueWithData");
        }
예제 #4
0
        public void ImageField_CreateField()
        {
            PokerImageField  field    = new PokerImageField();
            DataControlField newfield = field.DoCreateField();

            if (!(newfield is ImageField))
            {
                Assert.Fail("New ImageField was not created");
            }
        }
예제 #5
0
        public void ImageField_InitializeDataCell()
        {
            PokerImageField      field = new PokerImageField();
            DataControlFieldCell cell  = new DataControlFieldCell(null);

            field.DoInitializeDataCell(cell, DataControlRowState.Normal);
            Assert.AreEqual(0, cell.Controls.Count, "InitializeDataCellNormalNoData");
            field.DoInitializeDataCell(cell, DataControlRowState.Alternate);
            Assert.AreEqual(0, cell.Controls.Count, "InitializeDataCellAlternateNoData");
            field.DoInitializeDataCell(cell, DataControlRowState.Edit);
            Assert.AreEqual(1, cell.Controls.Count, "InitializeDataCellEditNoData");
            TextBox box = cell.Controls[0] as TextBox;

            if (box == null)
            {
                Assert.Fail("TextBox does not created on cell initilize");
            }

            cell.Controls.Clear();
            field.DataImageUrlField = "test";
            field.DoInitializeDataCell(cell, DataControlRowState.Normal);
            Assert.IsTrue(cell.Controls.Count > 0, "InitializeDataCellEditWithData");

            Image image = cell.Controls[0] as Image;

            if (image == null)
            {
                Assert.Fail("Image does not created on cell initilize");
            }

            cell.Controls.Clear();
            field.DoInitializeDataCell(cell, DataControlRowState.Insert);
            Assert.AreEqual(1, cell.Controls.Count, "InitializeDataCellInsertWithData");
            box = cell.Controls[0] as TextBox;
            if (box == null)
            {
                Assert.Fail("Text does not created on cell initilize Insert RowState");
            }

            cell.Controls.Clear();
            field.DoInitializeDataCell(cell, DataControlRowState.Selected);
            Assert.IsTrue(cell.Controls.Count > 0, "InitializeDataCellSelectedWithData");
        }
예제 #6
0
        public void ImageField_ExtractValuesFromCell()
        {
            PokerImageField   field      = new PokerImageField();
            OrderedDictionary dictionary = new OrderedDictionary();
            Image             image      = new Image();

            image.ImageUrl = "test";
            DataControlFieldCell cell = new DataControlFieldCell(null);

            cell.Controls.Add(image);
            field.ExtractValuesFromCell(dictionary, cell, DataControlRowState.Normal, true);
            Assert.AreEqual(1, dictionary.Count, "ExtractValuesFromCellCount");
            Assert.AreEqual("test", dictionary[0].ToString(), "ExtractValuesFromCellValue");
            cell.Controls.Clear();
            TextBox box = new TextBox();

            box.Text = "test";
            cell.Controls.Add(box);
            field.ExtractValuesFromCell(dictionary, cell, DataControlRowState.Normal, true);
            Assert.AreEqual(1, dictionary.Count, "ExtractValuesFromCellCount");
            Assert.AreEqual("test", dictionary[0].ToString(), "ExtractValuesFromCellValue");
        }
		public void ImageField_GetDesignTimeValue ()
		{
			PokerImageField field = new PokerImageField ();
			string result = field.DoGetDesignTimeValue ();
			Assert.AreEqual ("Databound", result, "GetDesignTimeValue");
		}
		public void ImageField_FormatDataNavigateUrlValue ()
		{
			PokerImageField field = new PokerImageField ();
			string result = field.DoFormatImageUrlValue (null);
			Assert.AreEqual (null, result, "DoFormatImageUrlValueEmpty");
			field.DataImageUrlFormatString = "-{0,8:G}-";
			result = field.DoFormatImageUrlValue (10);
			Assert.AreEqual ("-      10-", result, "FormatImageUrlValueWithData");
		}
		public void ImageField_CreateField ()
		{
			PokerImageField field = new PokerImageField ();
			DataControlField newfield = field.DoCreateField ();
			if (!(newfield is ImageField)) {
				Assert.Fail ("New ImageField was not created");
			}
		}
		public void ImageField_CopyProperties ()
		{
			PokerImageField field = new PokerImageField ();
			ImageField copy = new ImageField ();
			field.AlternateText = "test";
			field.ConvertEmptyStringToNull = true;
			field.DataAlternateTextField = "test";
			field.DataAlternateTextFormatString = "test";
			field.DataImageUrlField = "test";
			field.DataImageUrlFormatString = "test";
			field.NullDisplayText = "test";
			field.NullImageUrl = "test";
			field.ReadOnly = true;

			field.DoCopyProperties (copy);
			Assert.AreEqual ("test", copy.AlternateText, "AlternateText");
			Assert.AreEqual (true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull");
			Assert.AreEqual ("test", copy.DataAlternateTextField, "DataAlternateTextField");
			Assert.AreEqual ("test", copy.DataImageUrlField, "DataImageUrlField");
			Assert.AreEqual ("test", copy.DataAlternateTextFormatString, "DataAlternateTextFormatString");
			Assert.AreEqual ("test", copy.DataImageUrlField, "DataImageUrlField");
			Assert.AreEqual ("test", copy.DataImageUrlFormatString, "DataImageUrlFormatString");
			Assert.AreEqual ("test", copy.NullDisplayText, "NullDisplayText");
			Assert.AreEqual ("test", copy.NullImageUrl, "NullImageUrl");
			Assert.AreEqual (true, copy.ReadOnly, "ReadOnly");
		}
		public void ImageField_InitializeDataCell()
		{
			PokerImageField field = new PokerImageField ();
			DataControlFieldCell cell = new DataControlFieldCell(null);
		        field.DoInitializeDataCell(cell ,DataControlRowState.Normal);
			Assert.AreEqual (0, cell.Controls.Count, "InitializeDataCellNormalNoData");
			field.DoInitializeDataCell (cell, DataControlRowState.Alternate);
			Assert.AreEqual (0, cell.Controls.Count, "InitializeDataCellAlternateNoData");
			field.DoInitializeDataCell (cell, DataControlRowState.Edit);
			Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellEditNoData");
			TextBox box = cell.Controls[0] as TextBox;
			if (box == null)
				Assert.Fail ("TextBox does not created on cell initilize");

			cell.Controls.Clear ();
			field.DataImageUrlField = "test";
			field.DoInitializeDataCell (cell, DataControlRowState.Normal);
			Assert.IsTrue (cell.Controls.Count > 0, "InitializeDataCellEditWithData");

			Image image = cell.Controls[0] as Image;
			if (image==null)
				Assert.Fail ("Image does not created on cell initilize");

			cell.Controls.Clear ();
			field.DoInitializeDataCell (cell, DataControlRowState.Insert);
			Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellInsertWithData");
			box = cell.Controls[0] as TextBox;
			if (box == null)
				Assert.Fail ("Text does not created on cell initilize Insert RowState");

			cell.Controls.Clear ();
			field.DoInitializeDataCell (cell, DataControlRowState.Selected);
			Assert.IsTrue (cell.Controls.Count > 0, "InitializeDataCellSelectedWithData");
		}
		public void ImageField_ExtractValuesFromCell ()
		{
			PokerImageField field = new PokerImageField ();
			OrderedDictionary dictionary = new OrderedDictionary ();
			Image image = new Image ();
			image.ImageUrl = "test";
			DataControlFieldCell cell = new DataControlFieldCell (null);
			cell.Controls.Add (image);
			field.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
			Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount");
			Assert.AreEqual ("test", dictionary[0].ToString (), "ExtractValuesFromCellValue");
			cell.Controls.Clear ();
			TextBox box = new TextBox ();
			box.Text = "test";
			cell.Controls.Add (box);
			field.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true);
			Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount");
			Assert.AreEqual ("test", dictionary[0].ToString (), "ExtractValuesFromCellValue");
		}