public void Update_TreeInfoListNotEmptyAndSortInfoContainsOnlyDefaultValues_ShouldBeReturnListSortedAscendingByID()
        {
            // Arrange
            var treeInfoList = new List <TreeInfo> {
                _treeInfo3, _treeInfo2, _treeInfo1
            };

            var resultEditor = new ResultEditor(treeInfoList, _sortInfo);

            // Act
            resultEditor.Update();

            // Asserts
            Assert.Equal(3, treeInfoList.Count);

            Assert.Equal(treeInfoList[0].ID, _treeInfo1.ID);
            Assert.Equal(treeInfoList[1].ID, _treeInfo2.ID);
            Assert.Equal(treeInfoList[2].ID, _treeInfo3.ID);
        }
Example #2
0
        public void GetPreparedResults_TreeInfoListNotEmptyAndSortInfoContainsOnlyDefaultValues_ShouldBeReturnListSortedAscendingByID()
        {
            // Arrange
            var treeInfoList = new List <TreeInfo> {
                _treeInfo2, _treeInfo3, _treeInfo1
            };

            var resultEditor = new ResultEditor(treeInfoList, _sortInfo);

            // Act
            var results = resultEditor.GetPreparedResults();

            // Asserts
            Assert.Equal(3, results.Count);

            Assert.Equal(results[0].ID, _treeInfo1.ID);
            Assert.Equal(results[1].ID, _treeInfo2.ID);
            Assert.Equal(results[2].ID, _treeInfo3.ID);
        }
Example #3
0
        public void GetPreparedResults_PrepareSortInfoFilterDict_ShouldReturnListFilteredByFellingReasonValue()
        {
            // Arrange
            var treeInfoList = new List <TreeInfo> {
                _treeInfo1, _treeInfo2, _treeInfo3
            };

            _sortInfo.FilterProperties = new Dictionary <TreeSortProperty, string> {
                { TreeSortProperty.FellingGround, "FellingReason3" }
            };

            var resultEditor = new ResultEditor(treeInfoList, _sortInfo);

            // Act
            var results = resultEditor.GetPreparedResults();

            // Assert
            Assert.Single(results);

            Assert.Equal(results[0], _treeInfo3);
        }
Example #4
0
        public void GetPreparedResults_SetSortInfoSortProperty_ShouldBeReturnListSortedAscendingByDatum()
        {
            // Arrange
            var treeInfoList = new List <TreeInfo> {
                _treeInfo2, _treeInfo3, _treeInfo1
            };

            _sortInfo.SortProperty = "Datum";

            var resultEditor = new ResultEditor(treeInfoList, _sortInfo);

            // Act
            var results = resultEditor.GetPreparedResults();

            // Assert
            Assert.Equal(3, results.Count);

            Assert.Equal(results[0].Datum, _treeInfo1.Datum);
            Assert.Equal(results[1].Datum, _treeInfo2.Datum);
            Assert.Equal(results[2].Datum, _treeInfo3.Datum);
        }
Example #5
0
        public void GetPreparedResults_ChangeSortDirectionInSortInfoToDescending_ShouldBeReturnListSortedDescendingByID()
        {
            // Arrange
            var treeInfoList = new List <TreeInfo> {
                _treeInfo2, _treeInfo3, _treeInfo1
            };

            _sortInfo.SortAscending = false;

            var resultEditor = new ResultEditor(treeInfoList, _sortInfo);

            // Act
            var results = resultEditor.GetPreparedResults();

            // Assert
            Assert.Equal(3, results.Count);

            Assert.Equal(results[0].ID, _treeInfo3.ID);
            Assert.Equal(results[1].ID, _treeInfo2.ID);
            Assert.Equal(results[2].ID, _treeInfo1.ID);
        }
        /* Constructor */
        public MainPage()
        {
            InitializeComponent();

            var requestHandler = new RequestHandler <TreeInfo>();

            _results = requestHandler.GetRequestResult();

            _sortInfo = new SortInfo
            {
                FilterValue   = null,
                PageIndex     = _currentPage,
                PageSize      = _pageSize,
                SortAscending = true,
                SortProperty  = "ID"
            };

            _resultEditor = new ResultEditor(_results, _sortInfo);

            UpdateResults();

            UpdateFellingComboBox();
            UpdateDistrictComboBox();
        }