Beispiel #1
0
        VisualiseSchema_when_count_mod_page_size_more_than_zero_total_pages_returns_viewcontrollerdata_totalpages_is_equal_to_total_pages_plus_1()
        {
            //arrange
            IList <FilterCriteria> filter = null;
            DataSetSchema          schema = null;
            int    pageNumber             = 1;
            int    pageSize       = 3;
            string chartType      = null;
            string xAxis          = "123";
            string yAxis          = "11";
            string yAxisAggregate = null;
            var    ds             = new DataSet();

            ds.Tables.Add(ReturnDataTable(null, 50));
            ds.Tables.Add(ReturnDataTable(null, 10)); //10 mod 3  > 0
            ds.Tables.Add(ReturnDataTable(null, 1));  //this is tested ( count  of negative values)
            var vsCriteria = new VisualSchemaCriteria("", null, null, "", "", "", "", "", "", 0, 0);
            var mock       = new Mock <IDataSetDetailSqlRepo>();

            mock.Setup(x => x.ExecuteQueryVisualiseSchema(vsCriteria)).Returns(ds);
            mock.Setup(
                x =>
                x.ConvertToVisualSchemaCriteria(_repositoryDataSetDetail.DbConnectionString, filter, schema, chartType,
                                                xAxis, yAxis, yAxisAggregate, pageNumber, pageSize)).Returns(vsCriteria);
            _sqlRepo = mock.Object;
            var sut = new DataSetDetailService(_systemConfigurationService, _repositoryDataSetDetail, _dataSetSchemaService, _sqlRepo, _sqlColumnTextFormatter);
            //act
            var result = sut.VisualiseSchema(filter, schema, pageNumber, pageSize, chartType, xAxis, yAxis, yAxisAggregate);

            //assert
            Assert.AreEqual(4, result.TotalPages);
            //cleanup
            _sqlRepo = null;
        }
Beispiel #2
0
        VisualiseSchema_will_return_type_of_view_controller_data()
        {
            //arrange
            IList <FilterCriteria> filter = null;
            DataSetSchema          schema = null;
            int    pageNumber             = 0;
            int    pageSize       = 0;
            string chartType      = null;
            string xAxis          = null;
            string yAxis          = null;
            string yAxisAggregate = null;
            var    sut            = new DataSetDetailService(_systemConfigurationService, _repositoryDataSetDetail, _dataSetSchemaService, _sqlRepo, _sqlColumnTextFormatter);
            //act
            var result = sut.VisualiseSchema(filter, schema, pageNumber, pageSize, chartType, xAxis, yAxis, yAxisAggregate);

            //assert
            Assert.AreEqual(typeof(ViewControllerData), result.GetType());
        }