public SetFirstSortPropName ( string propName, bool toggleDirection ) : void | ||
propName | string | |
toggleDirection | bool | |
Результат | void |
public void SortTest2() { SetupTestList(); m_cgSorter.SetFirstSortPropName("StrProp", false); m_cgSorter.Sort("EnumProp", false); Assert.AreEqual("item1", ((DummyListItem)m_list[0]).StrProp); Assert.AreEqual("item4", ((DummyListItem)m_list[1]).StrProp); Assert.AreEqual("item2", ((DummyListItem)m_list[2]).StrProp); Assert.AreEqual("item3", ((DummyListItem)m_list[3]).StrProp); Assert.AreEqual(500, ((DummyListItem)m_list[0]).IntProp); Assert.AreEqual(200, ((DummyListItem)m_list[1]).IntProp); Assert.AreEqual(800, ((DummyListItem)m_list[2]).IntProp); Assert.AreEqual(100, ((DummyListItem)m_list[3]).IntProp); Assert.AreEqual(dummyEnum.One, ((DummyListItem)m_list[0]).EnumProp); Assert.AreEqual(dummyEnum.One, ((DummyListItem)m_list[1]).EnumProp); Assert.AreEqual(dummyEnum.Two, ((DummyListItem)m_list[2]).EnumProp); Assert.AreEqual(dummyEnum.Three, ((DummyListItem)m_list[3]).EnumProp); Assert.AreEqual("01/21/2008", ((DummyListItem)m_list[0]).DateProp.ToString("MM/dd/yyyy")); Assert.AreEqual("01/24/2008", ((DummyListItem)m_list[1]).DateProp.ToString("MM/dd/yyyy")); Assert.AreEqual("01/24/2008", ((DummyListItem)m_list[2]).DateProp.ToString("MM/dd/yyyy")); Assert.AreEqual("01/23/2008", ((DummyListItem)m_list[3]).DateProp.ToString("MM/dd/yyyy")); }
public void TestSetFirstSortPropNameMethod() { m_cgSorter = new CheckGridListSorter(new List <ICheckGridRowObject>()); List <StableSortInfo> ssOrders = ReflectionHelper.GetField(m_cgSorter, "m_stableOrder") as List <StableSortInfo>; Assert.AreEqual(0, ssOrders.Count); m_cgSorter.SetFirstSortPropName("prop3", false); m_cgSorter.SetFirstSortPropName("prop2", false); m_cgSorter.SetFirstSortPropName("prop1", false); Assert.AreEqual(3, ssOrders.Count); Assert.AreEqual("prop1", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[0].SortDirection); Assert.AreEqual("prop2", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection); Assert.AreEqual("prop3", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); m_cgSorter.SetFirstSortPropName("prop2", true); Assert.AreEqual("prop2", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection); Assert.AreEqual("prop1", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection); Assert.AreEqual("prop3", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); m_cgSorter.SetFirstSortPropName("prop3", true); Assert.AreEqual("prop3", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection); Assert.AreEqual("prop2", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[1].SortDirection); Assert.AreEqual("prop1", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); }
public void TestSetFirstSortPropNameMethod() { m_cgSorter = new CheckGridListSorter(new List<ICheckGridRowObject>()); List<StableSortInfo> ssOrders = ReflectionHelper.GetField(m_cgSorter, "m_stableOrder") as List<StableSortInfo>; Assert.AreEqual(0, ssOrders.Count); m_cgSorter.SetFirstSortPropName("prop3", false); m_cgSorter.SetFirstSortPropName("prop2", false); m_cgSorter.SetFirstSortPropName("prop1", false); Assert.AreEqual(3, ssOrders.Count); Assert.AreEqual("prop1", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[0].SortDirection); Assert.AreEqual("prop2", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection); Assert.AreEqual("prop3", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); m_cgSorter.SetFirstSortPropName("prop2", true); Assert.AreEqual("prop2", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection); Assert.AreEqual("prop1", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[1].SortDirection); Assert.AreEqual("prop3", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); m_cgSorter.SetFirstSortPropName("prop3", true); Assert.AreEqual("prop3", ssOrders[0].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[0].SortDirection); Assert.AreEqual("prop2", ssOrders[1].PropName); Assert.AreEqual(SortOrder.Descending, ssOrders[1].SortDirection); Assert.AreEqual("prop1", ssOrders[2].PropName); Assert.AreEqual(SortOrder.Ascending, ssOrders[2].SortDirection); }