Exemplo n.º 1
0
        public void NextPrevFormatProperty()
        {
            DateTimeFormatInfo dateInfo  = DateTimeFormatInfo.CurrentInfo;
            PokerCalendar      c         = new PokerCalendar();
            StringWriter       sw        = new StringWriter();
            HtmlTextWriter     tw        = new HtmlTextWriter(sw);
            DateTime           prevMonth = dateInfo.Calendar.AddMonths(DateTime.Today, -1);
            DateTime           nextMonth = dateInfo.Calendar.AddMonths(DateTime.Today, 1);

            c.NextMonthText = "NextMonthText";                  // CustomText
            c.PrevMonthText = "PrevMonthText";
            c.RenderControl(tw);
            Assert.AreEqual(true, sw.ToString().IndexOf(c.NextMonthText) != -1, "NextPrevFormat1");
            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) != -1, "NextPrevFormat2");

            sw = new StringWriter();
            tw = new HtmlTextWriter(sw);
            c.NextPrevFormat = NextPrevFormat.FullMonth;                // FullMonth
            c.RenderControl(tw);

            Assert.AreEqual(true, sw.ToString().IndexOf(dateInfo.GetMonthName(dateInfo.Calendar.GetMonth(prevMonth))) != -1, "NextPrevFormat3:" + sw.ToString() + "|||" + dateInfo.GetMonthName(DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth(prevMonth)));
            Assert.AreEqual(true, sw.ToString().IndexOf(dateInfo.GetMonthName(dateInfo.Calendar.GetMonth(nextMonth))) != -1, "NextPrevFormat4");

            sw = new StringWriter();
            tw = new HtmlTextWriter(sw);
            c.NextPrevFormat = NextPrevFormat.ShortMonth;               // ShortMonth
            c.RenderControl(tw);

            Assert.AreEqual(true, sw.ToString().IndexOf(dateInfo.GetAbbreviatedMonthName(dateInfo.Calendar.GetMonth(prevMonth))) != -1, "NextPrevFormat5");
            Assert.AreEqual(true, sw.ToString().IndexOf(dateInfo.GetAbbreviatedMonthName(dateInfo.Calendar.GetMonth(nextMonth))) != -1, "NextPrevFormat6");
        }
Exemplo n.º 2
0
        public void ShowTitleProperty()
        {
            String             monthName;
            DateTimeFormatInfo dateInfo = DateTimeFormatInfo.CurrentInfo;
            PokerCalendar      c        = new PokerCalendar();
            StringWriter       sw       = new StringWriter();
            HtmlTextWriter     tw       = new HtmlTextWriter(sw);

            c.NextMonthText = "NextMonthText";
            c.PrevMonthText = "PrevMonthText";
            c.RenderControl(tw);
            monthName = dateInfo.GetMonthName(dateInfo.Calendar.GetMonth(DateTime.Today));

            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) != -1, "ShowTitle1");
            Assert.AreEqual(true, sw.ToString().IndexOf(c.NextMonthText) != -1, "ShowTitle2");
            Assert.AreEqual(true, sw.ToString().IndexOf(monthName) != -1, "ShowTitle3");

            c.ShowTitle = false;
            sw          = new StringWriter();
            tw          = new HtmlTextWriter(sw);
            c.RenderControl(tw);

            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) == -1, "ShowTitle4");
            Assert.AreEqual(true, sw.ToString().IndexOf(c.NextMonthText) == -1, "ShowTitle5");
            Assert.AreEqual(true, sw.ToString().IndexOf(monthName) == -1, "ShowTitle6");
        }
Exemplo n.º 3
0
        public void SelectionChanged()
        {
            PokerCalendar c = new PokerCalendar();

            c.SelectionChanged += new EventHandler(SelectionChangedHandler);
            eventFired          = false;
            ((IPostBackEventHandler)c).RaisePostBackEvent("0001");
            Assert.AreEqual(true, eventFired, "SelectionChanged event");
        }
Exemplo n.º 4
0
        public void VisibleMonthChanged()
        {
            PokerCalendar c = new PokerCalendar();

            c.VisibleMonthChanged += new MonthChangedEventHandler(VisibleMonthChangedHandler);
            eventFired             = false;
            ((IPostBackEventHandler)c).RaisePostBackEvent("V0001");
            Assert.AreEqual(true, eventFired, "VisibleMonthChanged event");
        }
Exemplo n.º 5
0
        public void WeekendDayStyleProperty()
        {
            PokerCalendar  c  = new PokerCalendar();
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.WeekendDayStyle.BackColor = Color.Green;
            c.RenderControl(tw);
            Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("green") != -1, "WeekendDayStyle");
        }
Exemplo n.º 6
0
        public void PrevMonthTextProperty()
        {
            PokerCalendar  c  = new PokerCalendar();
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.PrevMonthText = "PrevMonthText";
            c.RenderControl(tw);
            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) != -1, "PrevMonthText");
        }
Exemplo n.º 7
0
        public void TestDayRenderCellAdd()
        {
            PokerCalendar p = new PokerCalendar();

            tofind = Guid.NewGuid().ToString();

            p.DayRender += new DayRenderEventHandler(Event_TestDayRenderCellAdd_DayRender);

            Assert.IsTrue(p.Render().IndexOf(tofind) != -1, "control added");
        }
Exemplo n.º 8
0
        public void TestSelectedColorDefault()
        {
            PokerCalendar p = new PokerCalendar();

            p.TodaysDate   = new DateTime(2005, 8, 4);
            p.SelectedDate = p.TodaysDate;
            string s = p.Render();

            Assert.IsTrue(s.IndexOf("color:White") != 1 && s.IndexOf("background-color:Silver") != -1, "A1");
        }
Exemplo n.º 9
0
        public void TestRenderMonthStartsOnSunday()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", false);
            PokerCalendar p = new PokerCalendar();

            p.TodaysDate = new DateTime(2005, 5, 14);

            first        = true;
            p.DayRender += new DayRenderEventHandler(Event_TestRenderMonthStartsOnSunday_DayRender);
            p.Render();
        }
Exemplo n.º 10
0
        public void HaveID()
        {
            PokerCalendar p = new PokerCalendar();

            p.ID           = "hola";
            p.TodaysDate   = new DateTime(2005, 8, 4);
            p.SelectedDate = p.TodaysDate;
            string s = p.Render();

            Assert.IsTrue(s.IndexOf("id=\"hola\"") != -1, "#01");
        }
Exemplo n.º 11
0
        public void SelectorStyleProperty()
        {
            PokerCalendar  c  = new PokerCalendar();
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.SelectorStyle.BackColor = Color.Green;
            c.SelectionMode           = CalendarSelectionMode.DayWeek;
            c.RenderControl(tw);
            Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("green") != -1, "SelectorStyleProperty");
        }
Exemplo n.º 12
0
        public void SelectedDayStyleProperty()
        {
            PokerCalendar  c  = new PokerCalendar();
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.SelectedDayStyle.BackColor = Color.Green;
            c.TodaysDate = new DateTime(2000, 1, 1);
            ((IPostBackEventHandler)c).RaisePostBackEvent("0001");
            c.RenderControl(tw);
            Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("green") != -1, "SelectedDayStyle");
        }
Exemplo n.º 13
0
        public void SelectDateProperty()
        {
            PokerCalendar c     = new PokerCalendar();
            DateTime      now   = DateTime.Now;
            DateTime      today = now.Date;

            c.SelectedDate = today;
            Assert.AreEqual(today, c.SelectedDate, "SelectDateProperty #1");

            c.SelectedDate = now;
            Assert.AreEqual(now, c.SelectedDate, "SelectDateProperty #2");
        }
Exemplo n.º 14
0
        public void HaveBaseAttributes()
        {
            PokerCalendar p = new PokerCalendar();

            p.ID           = "hola";
            p.ToolTip      = "adios";
            p.TodaysDate   = new DateTime(2005, 8, 4);
            p.SelectedDate = p.TodaysDate;
            string s = p.Render();

            Assert.IsTrue(s.IndexOf("adios") != -1, "#01");
            Assert.IsTrue(p.CS_Called == true, "#02");
        }
Exemplo n.º 15
0
        public void DayRender()
        {
            PokerCalendar c = new PokerCalendar();

            c.DayRender += new DayRenderEventHandler(DayRenderEventHandler);
            days         = 0;

            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.RenderControl(tw);
            Assert.AreEqual(6 * 7, days, "DayRender event");
            Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("yellow") != -1, "DayRender event change");
        }
Exemplo n.º 16
0
        public void ShowNextPrevMonthProperty()
        {
            PokerCalendar  c  = new PokerCalendar();
            StringWriter   sw = new StringWriter();
            HtmlTextWriter tw = new HtmlTextWriter(sw);

            c.NextMonthText = "NextMonthText";
            c.PrevMonthText = "PrevMonthText";
            c.RenderControl(tw);

            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) != -1, "ShowNextPrevMonth1");
            Assert.AreEqual(true, sw.ToString().IndexOf(c.NextMonthText) != -1, "ShowNextPrevMonth2");

            c.ShowNextPrevMonth = false;
            sw = new StringWriter();
            tw = new HtmlTextWriter(sw);
            c.RenderControl(tw);

            Assert.AreEqual(true, sw.ToString().IndexOf(c.PrevMonthText) == -1, "ShowNextPrevMonth3");
            Assert.AreEqual(true, sw.ToString().IndexOf(c.NextMonthText) == -1, "ShowNextPrevMonth4");
        }
Exemplo n.º 17
0
        public void Calendar_DefaultValues()
        {
            PokerCalendar c = new PokerCalendar();

            Assert.AreEqual(2, c.CellPadding, "CellPadding");
            Assert.AreEqual(0, c.CellSpacing, "CellSpacing");
            Assert.AreEqual(DayNameFormat.Short, c.DayNameFormat, "DayNameFormat");
            Assert.AreEqual(FirstDayOfWeek.Default, c.FirstDayOfWeek, "FirstDayOfWeek");
            Assert.AreEqual(">", c.NextMonthText, "NextMonthText");
            Assert.AreEqual(NextPrevFormat.CustomText, c.NextPrevFormat, "NextPrevFormat");
            Assert.AreEqual("<", c.PrevMonthText, "PrevMonthText");
            Assert.AreEqual(CalendarSelectionMode.Day, c.SelectionMode, "SelectionMode");
            Assert.AreEqual(">>", c.SelectMonthText, "SelectMonthText");
            Assert.AreEqual(">", c.SelectWeekText, "SelectWeekText");
            Assert.AreEqual(true, c.ShowDayHeader, "ShowDayHeader");
            Assert.AreEqual(false, c.ShowGridLines, "ShowGridLines");
            Assert.AreEqual(true, c.ShowNextPrevMonth, "ShowNextPrevMonth");
            Assert.AreEqual(true, c.ShowTitle, "ShowTitle");
            Assert.AreEqual(TitleFormat.MonthYear, c.TitleFormat, "TitleFormat");
            Assert.AreEqual(DateTime.Today, c.TodaysDate, "TodaysDate");
            Assert.AreEqual(DateTime.MinValue, c.VisibleDate, "VisibleDate");
        }
Exemplo n.º 18
0
		public void ShowNextPrevMonthProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.NextMonthText = "NextMonthText";
			c.PrevMonthText = "PrevMonthText";
			c.RenderControl (tw);

			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) != -1, "ShowNextPrevMonth1");
			Assert.AreEqual (true, sw.ToString().IndexOf (c.NextMonthText) != -1, "ShowNextPrevMonth2");

			c.ShowNextPrevMonth = false;
			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			c.RenderControl (tw);

			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) == -1, "ShowNextPrevMonth3");
			Assert.AreEqual (true, sw.ToString().IndexOf (c.NextMonthText) == -1, "ShowNextPrevMonth4");
		}
Exemplo n.º 19
0
		public void SelectDateProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			DateTime now = DateTime.Now;
			DateTime today = now.Date;
			
			c.SelectedDate = today;
			Assert.AreEqual (today, c.SelectedDate, "SelectDateProperty #1");

			c.SelectedDate = now;
			Assert.AreEqual (today, c.SelectedDate, "SelectDateProperty #2");
		}
Exemplo n.º 20
0
		public void CellSpacingException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.CellSpacing = -2;
		}
Exemplo n.º 21
0
		public void ShowTitleProperty ()
		{
			String monthName;
			DateTimeFormatInfo dateInfo = DateTimeFormatInfo.CurrentInfo;
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.NextMonthText = "NextMonthText";
			c.PrevMonthText = "PrevMonthText";
			c.RenderControl (tw);
			monthName = dateInfo.GetMonthName (dateInfo.Calendar.GetMonth (DateTime.Today));

			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) != -1, "ShowTitle1");
			Assert.AreEqual (true, sw.ToString().IndexOf (c.NextMonthText) != -1, "ShowTitle2");
			Assert.AreEqual (true, sw.ToString().IndexOf (monthName) != -1, "ShowTitle3");

			c.ShowTitle = false;
			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			c.RenderControl (tw);

			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) == -1, "ShowTitle4");
			Assert.AreEqual (true, sw.ToString().IndexOf (c.NextMonthText) == -1, "ShowTitle5");
			Assert.AreEqual (true, sw.ToString().IndexOf (monthName) == -1, "ShowTitle6");
		}
Exemplo n.º 22
0
        public void FirstDayOfWeekException()
        {
            PokerCalendar c = new PokerCalendar();

            c.FirstDayOfWeek = (FirstDayOfWeek)15;
        }
Exemplo n.º 23
0
        public void SelectionModeException()
        {
            PokerCalendar c = new PokerCalendar();

            c.SelectionMode = (CalendarSelectionMode)15;
        }
Exemplo n.º 24
0
		public void Calendar_DefaultValues ()
		{
			PokerCalendar c = new PokerCalendar ();

			Assert.AreEqual (2, c.CellPadding, "CellPadding");
			Assert.AreEqual (0, c.CellSpacing, "CellSpacing");
			Assert.AreEqual (DayNameFormat.Short, c.DayNameFormat, "DayNameFormat");
			Assert.AreEqual (FirstDayOfWeek.Default, c.FirstDayOfWeek, "FirstDayOfWeek");
			Assert.AreEqual (">",c.NextMonthText, "NextMonthText");
			Assert.AreEqual (NextPrevFormat.CustomText, c.NextPrevFormat, "NextPrevFormat");
			Assert.AreEqual ("<", c.PrevMonthText, "PrevMonthText");
			Assert.AreEqual (CalendarSelectionMode.Day, c.SelectionMode, "SelectionMode");
			Assert.AreEqual (">>", c.SelectMonthText, "SelectMonthText");
			Assert.AreEqual (">", c.SelectWeekText, "SelectWeekText");
			Assert.AreEqual (true, c.ShowDayHeader, "ShowDayHeader");
			Assert.AreEqual (false, c.ShowGridLines, "ShowGridLines");
			Assert.AreEqual (true, c.ShowNextPrevMonth , "ShowNextPrevMonth");
			Assert.AreEqual (true, c.ShowTitle, "ShowTitle");
			Assert.AreEqual (TitleFormat.MonthYear, c.TitleFormat, "TitleFormat");
			Assert.AreEqual (DateTime.Today, c.TodaysDate , "TodaysDate");
			Assert.AreEqual (DateTime.MinValue, c.VisibleDate, "VisibleDate");
		}
Exemplo n.º 25
0
        public void CellSpacingException()
        {
            PokerCalendar c = new PokerCalendar();

            c.CellSpacing = -2;
        }
Exemplo n.º 26
0
		public void HaveID ()
		{
			PokerCalendar p = new PokerCalendar ();
			p.ID = "hola";
			p.TodaysDate = new DateTime (2005, 8, 4);
			p.SelectedDate = p.TodaysDate;
			string s = p.Render();
			Assert.IsTrue (s.IndexOf ("id=\"hola\"") != -1, "#01");
		}
Exemplo n.º 27
0
		public void HaveBaseAttributes ()
		{
			PokerCalendar p = new PokerCalendar ();
			p.ID = "hola";
			p.ToolTip = "adios";
			p.TodaysDate = new DateTime (2005, 8, 4);
			p.SelectedDate = p.TodaysDate;
			string s = p.Render();
			Assert.IsTrue (s.IndexOf ("adios") != -1, "#01");
			Assert.IsTrue (p.CS_Called == true, "#02");
		}
Exemplo n.º 28
0
		public void TestSelectedColorDefault ()
		{
			PokerCalendar p = new PokerCalendar ();
			p.TodaysDate = new DateTime (2005, 8, 4);
			p.SelectedDate = p.TodaysDate;
			string s = p.Render();
			Assert.IsTrue (s.IndexOf ("color:White") != 1 && s.IndexOf ("background-color:Silver") != -1, "A1");
		}
Exemplo n.º 29
0
		public void TestRenderMonthStartsOnSunday ()
		{
			Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
			PokerCalendar p = new PokerCalendar ();
			p.TodaysDate = new DateTime (2005, 5, 14);
			
			first = true;
			p.DayRender += new DayRenderEventHandler(Event_TestRenderMonthStartsOnSunday_DayRender);
			p.Render ();
		}
Exemplo n.º 30
0
		public void TestDayRenderCellAdd ()
		{
			PokerCalendar p = new PokerCalendar ();
			tofind = Guid.NewGuid ().ToString ();

			p.DayRender += new DayRenderEventHandler(Event_TestDayRenderCellAdd_DayRender);

			Assert.IsTrue (p.Render ().IndexOf (tofind) != -1, "control added");
		}
Exemplo n.º 31
0
		public void SelectedDayStyleProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.SelectedDayStyle.BackColor = Color.Green;
			c.TodaysDate = new DateTime (2000, 1,1);
			((IPostBackEventHandler)c).RaisePostBackEvent ("0001");
			c.RenderControl (tw);
			Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("green") != -1, "SelectedDayStyle");
		}
Exemplo n.º 32
0
		public void SelectorStyleProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.SelectorStyle.BackColor = Color.Green;
			c.SelectionMode = CalendarSelectionMode.DayWeek;
			c.RenderControl (tw);
			Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("green") != -1, "SelectorStyleProperty");
		}
Exemplo n.º 33
0
		public void Calendar_ViewState ()
		{
			PokerCalendar p = new PokerCalendar ();
			p.CellPadding = 10;
			p.CellSpacing = 20;
  			p.DayNameFormat = DayNameFormat.Short;
			p.FirstDayOfWeek = FirstDayOfWeek.Friday;
			p.NextMonthText = "NextMonth";
			p.NextPrevFormat = NextPrevFormat.ShortMonth;
			p.PrevMonthText = "PrevMonth";
			p.SelectionMode = CalendarSelectionMode.DayWeek;
			p.SelectMonthText = "SelectMonth";
			p.SelectWeekText = "SelectWeek";
			p.ShowDayHeader = false;
			p.ShowGridLines = true;
			p.ShowNextPrevMonth = false;
			p.ShowTitle = false;
			p.TitleFormat = TitleFormat.Month;
			p.TodaysDate = new DateTime (1999,1,1);
			p.VisibleDate = new DateTime (1998,1,1);
#if NET_2_0
			p.Caption = "This is a Caption";
			p.CaptionAlign = TableCaptionAlign.Right;
#endif

			p.DayHeaderStyle.BackColor = Color.Blue;
			p.DayStyle.BackColor = Color.Yellow;
			p.NextPrevStyle.BackColor = Color.Red;
			p.OtherMonthDayStyle.BackColor = Color.Green;
			p.SelectedDayStyle.BackColor = Color.Silver;
			p.SelectorStyle.BackColor = Color.Pink;
			p.TodayDayStyle.BackColor = Color.White;
			p.WeekendDayStyle.BackColor = Color.Brown;

			object state = p.SaveState ();

			PokerCalendar copy = new PokerCalendar ();
			copy.LoadState (state);

			Assert.AreEqual (10, copy.CellPadding, "CellPadding");
			Assert.AreEqual (20, copy.CellSpacing, "CellSpacing");
			Assert.AreEqual (DayNameFormat.Short, copy.DayNameFormat, "DayNameFormat");
			Assert.AreEqual (FirstDayOfWeek.Friday, copy.FirstDayOfWeek, "FirstDayOfWeek");
			Assert.AreEqual ("NextMonth", copy.NextMonthText, "NextMonthText");
			Assert.AreEqual (NextPrevFormat.ShortMonth, copy.NextPrevFormat, "NextPrevFormat");
			Assert.AreEqual ("PrevMonth", copy.PrevMonthText, "PrevMonthText");
			Assert.AreEqual (CalendarSelectionMode.DayWeek, copy.SelectionMode, "SelectionMode");
			Assert.AreEqual ("SelectMonth", copy.SelectMonthText, "SelectMonthText");
			Assert.AreEqual ("SelectWeek", copy.SelectWeekText, "SelectWeekText");
			Assert.AreEqual (false, copy.ShowDayHeader, "ShowDayHeader");
			Assert.AreEqual (true, copy.ShowGridLines, "ShowGridLines");
			Assert.AreEqual (false, copy.ShowNextPrevMonth, "ShowNextPrevMonth");
			Assert.AreEqual (false, copy.ShowTitle, "ShowTitle");
			Assert.AreEqual (TitleFormat.Month, copy.TitleFormat, "TitleFormat");
			Assert.AreEqual (new DateTime (1999,1,1), copy.TodaysDate, "TodaysDate");
			Assert.AreEqual (new DateTime (1998,1,1), copy.VisibleDate, "VisibleDate");

#if NET_2_0
			Assert.AreEqual ("This is a Caption", copy.Caption, "Caption");
			Assert.AreEqual (TableCaptionAlign.Right, copy.CaptionAlign, "CaptionAlign");
#endif

			copy.ShowDayHeader = true;
			copy.ShowNextPrevMonth = true;
			copy.ShowTitle = true;
			copy.TodaysDate = copy.VisibleDate;

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("blue") != -1, "DayHeaderStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("yellow") != -1, "BackColor");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("red") != -1, "NextPrevStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("green") != -1, "OtherMonthDayStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("silver") != -1, "SelectedDayStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("green") != -1, "OtherMonthDayStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("pink") != -1, "SelectorStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("white") != -1, "TodayDayStyle");
			}

			{
				StringWriter sw = new StringWriter ();
				HtmlTextWriter tw = new HtmlTextWriter (sw);
				copy.RenderControl (tw);
				Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("brown") != -1, "WeekendDayStyle");
			}
		}
Exemplo n.º 34
0
		public void VisibleMonthChanged ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.VisibleMonthChanged += new MonthChangedEventHandler (VisibleMonthChangedHandler);
			eventFired = false;
			((IPostBackEventHandler)c).RaisePostBackEvent ("V0001");
			Assert.AreEqual (true, eventFired, "VisibleMonthChanged event");
		}
Exemplo n.º 35
0
        public void DayNameFormatException()
        {
            PokerCalendar c = new PokerCalendar();

            c.DayNameFormat = (DayNameFormat)10;
        }
Exemplo n.º 36
0
		public void SelectionChanged ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.SelectionChanged += new EventHandler (SelectionChangedHandler);
			eventFired = false;
			((IPostBackEventHandler)c).RaisePostBackEvent ("0001");
			Assert.AreEqual (true, eventFired, "SelectionChanged event");
		}
Exemplo n.º 37
0
        public void NextPrevFormatException()
        {
            PokerCalendar c = new PokerCalendar();

            c.NextPrevFormat = (NextPrevFormat)15;
        }
Exemplo n.º 38
0
		public void TitleFormatException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.TitleFormat = (TitleFormat) 15;
		}
Exemplo n.º 39
0
        public void TitleFormatException()
        {
            PokerCalendar c = new PokerCalendar();

            c.TitleFormat = (TitleFormat)15;
        }
Exemplo n.º 40
0
		public void SelectionModeException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.SelectionMode = (CalendarSelectionMode) 15;
		}
Exemplo n.º 41
0
		public void CellPaddingException ()
		{
			PokerCalendar p = new PokerCalendar ();
			p.CellPadding = -2;
		}
Exemplo n.º 42
0
		public void NextPrevFormatException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.NextPrevFormat = (NextPrevFormat) 15;
		}
Exemplo n.º 43
0
        public void Calendar_ViewState()
        {
            PokerCalendar p = new PokerCalendar();

            p.CellPadding       = 10;
            p.CellSpacing       = 20;
            p.DayNameFormat     = DayNameFormat.Short;
            p.FirstDayOfWeek    = FirstDayOfWeek.Friday;
            p.NextMonthText     = "NextMonth";
            p.NextPrevFormat    = NextPrevFormat.ShortMonth;
            p.PrevMonthText     = "PrevMonth";
            p.SelectionMode     = CalendarSelectionMode.DayWeek;
            p.SelectMonthText   = "SelectMonth";
            p.SelectWeekText    = "SelectWeek";
            p.ShowDayHeader     = false;
            p.ShowGridLines     = true;
            p.ShowNextPrevMonth = false;
            p.ShowTitle         = false;
            p.TitleFormat       = TitleFormat.Month;
            p.TodaysDate        = new DateTime(1999, 1, 1);
            p.VisibleDate       = new DateTime(1998, 1, 1);
#if NET_2_0
            p.Caption      = "This is a Caption";
            p.CaptionAlign = TableCaptionAlign.Right;
#endif

            p.DayHeaderStyle.BackColor     = Color.Blue;
            p.DayStyle.BackColor           = Color.Yellow;
            p.NextPrevStyle.BackColor      = Color.Red;
            p.OtherMonthDayStyle.BackColor = Color.Green;
            p.SelectedDayStyle.BackColor   = Color.Silver;
            p.SelectorStyle.BackColor      = Color.Pink;
            p.TodayDayStyle.BackColor      = Color.White;
            p.WeekendDayStyle.BackColor    = Color.Brown;

            object state = p.SaveState();

            PokerCalendar copy = new PokerCalendar();
            copy.LoadState(state);

            Assert.AreEqual(10, copy.CellPadding, "CellPadding");
            Assert.AreEqual(20, copy.CellSpacing, "CellSpacing");
            Assert.AreEqual(DayNameFormat.Short, copy.DayNameFormat, "DayNameFormat");
            Assert.AreEqual(FirstDayOfWeek.Friday, copy.FirstDayOfWeek, "FirstDayOfWeek");
            Assert.AreEqual("NextMonth", copy.NextMonthText, "NextMonthText");
            Assert.AreEqual(NextPrevFormat.ShortMonth, copy.NextPrevFormat, "NextPrevFormat");
            Assert.AreEqual("PrevMonth", copy.PrevMonthText, "PrevMonthText");
            Assert.AreEqual(CalendarSelectionMode.DayWeek, copy.SelectionMode, "SelectionMode");
            Assert.AreEqual("SelectMonth", copy.SelectMonthText, "SelectMonthText");
            Assert.AreEqual("SelectWeek", copy.SelectWeekText, "SelectWeekText");
            Assert.AreEqual(false, copy.ShowDayHeader, "ShowDayHeader");
            Assert.AreEqual(true, copy.ShowGridLines, "ShowGridLines");
            Assert.AreEqual(false, copy.ShowNextPrevMonth, "ShowNextPrevMonth");
            Assert.AreEqual(false, copy.ShowTitle, "ShowTitle");
            Assert.AreEqual(TitleFormat.Month, copy.TitleFormat, "TitleFormat");
            Assert.AreEqual(new DateTime(1999, 1, 1), copy.TodaysDate, "TodaysDate");
            Assert.AreEqual(new DateTime(1998, 1, 1), copy.VisibleDate, "VisibleDate");

#if NET_2_0
            Assert.AreEqual("This is a Caption", copy.Caption, "Caption");
            Assert.AreEqual(TableCaptionAlign.Right, copy.CaptionAlign, "CaptionAlign");
#endif

            copy.ShowDayHeader     = true;
            copy.ShowNextPrevMonth = true;
            copy.ShowTitle         = true;
            copy.TodaysDate        = copy.VisibleDate;

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("blue") != -1, "DayHeaderStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("yellow") != -1, "BackColor");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("red") != -1, "NextPrevStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("green") != -1, "OtherMonthDayStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("silver") != -1, "SelectedDayStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("green") != -1, "OtherMonthDayStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("pink") != -1, "SelectorStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("white") != -1, "TodayDayStyle");
            }

            {
                StringWriter   sw = new StringWriter();
                HtmlTextWriter tw = new HtmlTextWriter(sw);
                copy.RenderControl(tw);
                Assert.AreEqual(true, sw.ToString().ToLower().IndexOf("brown") != -1, "WeekendDayStyle");
            }
        }
Exemplo n.º 44
0
		public void FirstDayOfWeekException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.FirstDayOfWeek = (FirstDayOfWeek) 15;
		}
Exemplo n.º 45
0
		public void PrevMonthTextProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.PrevMonthText = "PrevMonthText";
			c.RenderControl (tw);
			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) != -1, "PrevMonthText");
		}
Exemplo n.º 46
0
		public void DayNameFormatException ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.DayNameFormat = (DayNameFormat) 10;
		}
Exemplo n.º 47
0
		public void WeekendDayStyleProperty ()
		{
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.WeekendDayStyle.BackColor = Color.Green;
			c.RenderControl (tw);
			Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("green") != -1, "WeekendDayStyle");
		}
Exemplo n.º 48
0
        public void CellPaddingException()
        {
            PokerCalendar p = new PokerCalendar();

            p.CellPadding = -2;
        }
Exemplo n.º 49
0
		public void NextPrevFormatProperty ()
		{
			DateTimeFormatInfo dateInfo = DateTimeFormatInfo.CurrentInfo;
			PokerCalendar c = new PokerCalendar ();
			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			DateTime prevMonth = dateInfo.Calendar.AddMonths (DateTime.Today, -1);
			DateTime nextMonth = dateInfo.Calendar.AddMonths (DateTime.Today, 1);

			c.NextMonthText = "NextMonthText";	// CustomText
			c.PrevMonthText = "PrevMonthText";
			c.RenderControl (tw);
			Assert.AreEqual (true, sw.ToString().IndexOf (c.NextMonthText) != -1, "NextPrevFormat1");
			Assert.AreEqual (true, sw.ToString().IndexOf (c.PrevMonthText) != -1, "NextPrevFormat2");

			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			c.NextPrevFormat = NextPrevFormat.FullMonth;	// FullMonth
			c.RenderControl (tw);

			Assert.AreEqual (true, sw.ToString ().IndexOf (dateInfo.GetMonthName (dateInfo.Calendar.GetMonth (prevMonth))) != -1, "NextPrevFormat3:" + sw.ToString () + "|||" + dateInfo.GetMonthName (DateTimeFormatInfo.CurrentInfo.Calendar.GetMonth (prevMonth)));
			Assert.AreEqual (true, sw.ToString ().IndexOf (dateInfo.GetMonthName (dateInfo.Calendar.GetMonth (nextMonth))) != -1, "NextPrevFormat4");

			sw = new StringWriter ();
			tw = new HtmlTextWriter (sw);
			c.NextPrevFormat = NextPrevFormat.ShortMonth;	// ShortMonth
			c.RenderControl (tw);

			Assert.AreEqual (true, sw.ToString ().IndexOf (dateInfo.GetAbbreviatedMonthName (dateInfo.Calendar.GetMonth (prevMonth))) != -1, "NextPrevFormat5");
			Assert.AreEqual (true, sw.ToString ().IndexOf (dateInfo.GetAbbreviatedMonthName (dateInfo.Calendar.GetMonth (nextMonth))) != -1, "NextPrevFormat6");
		}
Exemplo n.º 50
0
		public void DayRender ()
		{
			PokerCalendar c = new PokerCalendar ();
			c.DayRender += new DayRenderEventHandler (DayRenderEventHandler);
			days = 0;

			StringWriter sw = new StringWriter ();
			HtmlTextWriter tw = new HtmlTextWriter (sw);
			c.RenderControl (tw);
			Assert.AreEqual (6 * 7, days, "DayRender event");
			Assert.AreEqual (true, sw.ToString().ToLower().IndexOf ("yellow") != -1, "DayRender event change");
		}