public void GetSortingTest()
        {
            var vm = Mock.Create<ProcessSearchGridGadgetGridTabViewModel>(Behavior.CallOriginal);

            var d1 = new SortList { new SortDescriptor("test", SortDirection.Ascending) };
            Mock.Arrange(() => vm.SortDescriptors).Returns(d1);
            Mock.Arrange(() => vm.Refresh(0)).DoNothing();

            vm.Refresh(d1);
           
            var actual = vm.GetSorting();

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(d1[0].ColumnName, actual[0].ColumnName);
            Assert.AreEqual(d1[0].Direction, actual[0].Direction);
            Assert.AreEqual(d1[0].IsGrouped, actual[0].IsGrouped);
        }
Exemplo n.º 2
0
        public void ApplyingGroupigPreserveFiltering()
        {
            var vm = GetNewSearchListVm();

            var filter = new FilterViewModel(FilterType.UserFilter) { Name = "Description 2" };

            Mock.Arrange(() => vm.AppliedFilter).Returns(filter);

            var isCalled = false;
            Mock.Arrange(() => vm.RefreshSearchList(vm.AppliedFilter)).DoInstead(() => isCalled = true);

            var sortDescriptors = new SortList();
            vm.Refresh("description_f", sortDescriptors);

            Assert.IsTrue(isCalled);
        }