public void SetUp() { ism = new InitialSelectionManager(); coll = new ListItemCollection(); //Put some dates in the collection DateTime start = new DateTime(2007, 1, 1); DateTime end = new DateTime(2009, 1, 1); for (DateTime date = start; date <= end; date = date.AddHours(6)) { coll.Add(date.ToString(DateFormat, CultureInfo.InvariantCulture)); } }
/// <summary> /// <para>The overridden method called just before saving view state and rendering the content. It is responsible /// for setting the generated date/time items and set the initial selection.</para> /// </summary> /// <param name="e"> /// an instance of the EventArgs. This argument is not directly used in this method - it is simply sent to the /// super method. Can be any value. /// </param> /// <exception cref="InitialSelectionInvalidDataException"> /// if any problem with setting initial selection occurs. /// </exception> /// <exception cref="RuleInvalidDataException"> /// if any problem with generating date/time items by Rule class occurs /// </exception> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!Page.IsPostBack) { //Get dates and add to items string[] dates = DatePattern.GenerateDates(); foreach (string date in dates) { Items.Add(date); } //Initial selection InitialSelectionManager initSelectionMgr = new InitialSelectionManager( InitialSelection, InitialSelectionTimeStamp, InitialSelectionDateFormat); initSelectionMgr.SelectItems(Items, false, DisplayDateFormat); } }
/// <summary> /// <para>The overridden method called just before saving view state and rendering the content. It is responsible /// for setting the generated date/time items and set the initial selection.</para> /// </summary> /// <param name="e"> /// an instance of the EventArgs. This argument is not directly used in this method - it is simply sent to the /// super method. Can be any value. /// </param> /// <exception cref="InitialSelectionInvalidDataException"> /// if any problem with setting initial selection occurs. /// </exception> /// <exception cref="RuleInvalidDataException"> /// if any problem with generating date/time items by Rule class occurs /// </exception> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!Page.IsPostBack) { //Get dates and add to items string[] dates = DatePattern.GenerateDates(); foreach (string date in dates) { Items.Add(date); } //Initial selection InitialSelectionManager initSelectionMgr = new InitialSelectionManager( InitialSelection, InitialSelectionTimeStamp, InitialSelectionDateFormat); //Allow multiple selected dates if the control allows initSelectionMgr.SelectItems(Items, (SelectionMode == ListSelectionMode.Multiple), DisplayDateFormat); } }
public void TestConstructor3() { ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp, DateFormat); Assert.IsNotNull(ism, "Contructor returns null."); }
public void TearDown() { ism = null; coll = null; }
public void TestConstructorFail3() { ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp, "08/03/2007 21:45", null); }
public void TestConstructorFail2() { ism = new InitialSelectionManager(InitialSelectionManager.SelectClosestNotAfterTimeStamp, null, DateFormat); }
public void TestConstructorFail1() { ism = new InitialSelectionManager(null, "08/03/2007 21:45", DateFormat); }