Example #1
0
        public void Test_TemperatureResponse_AgregateWith_Successful()
        {
            var responseClone = new TemperatureStatisticsResponse()
            {
                ResultStatus            = _response.ResultStatus,
                CellSize                = _response.CellSize,
                CellsScannedOverTarget  = _response.CellsScannedOverTarget,
                CellsScannedAtTarget    = _response.CellsScannedAtTarget,
                CellsScannedUnderTarget = _response.CellsScannedUnderTarget,
                SummaryCellsScanned     = _response.SummaryCellsScanned,
                IsTargetValueConstant   = _response.IsTargetValueConstant,
                LastTempRangeMax        = _response.LastTempRangeMax,
                LastTempRangeMin        = _response.LastTempRangeMin
            };

            var response = _response.AggregateWith(responseClone);

            Assert.True(Math.Abs(response.CellSize - _response.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after aggregation.");
            Assert.True(response.SummaryCellsScanned == _response.SummaryCellsScanned * 2, "Invalid aggregated value for SummaryCellsScanned.");
            Assert.True(response.LastTempRangeMax == _response.LastTempRangeMax, "Invalid aggregated value for LastTempRangeMax.");
            Assert.True(response.LastTempRangeMin == _response.LastTempRangeMin, "Invalid aggregated value for LastTempRangeMin.");
            Assert.True(response.CellsScannedOverTarget == _response.CellsScannedOverTarget * 2, "Invalid aggregated value for CellsScannedOverTarget.");
            Assert.True(response.CellsScannedAtTarget == _response.CellsScannedAtTarget * 2, "Invalid aggregated value for CellsScannedAtTarget.");
            Assert.True(response.CellsScannedUnderTarget == _response.CellsScannedUnderTarget * 2, "Invalid aggregated value for CellsScannedUnderTarget.");
            Assert.True(response.IsTargetValueConstant == _response.IsTargetValueConstant, "Invalid aggregated value for IsTargetValueConstant.");
            Assert.True(response.MissingTargetValue == _response.MissingTargetValue, "Invalid aggregated value for MissingTargetValue.");
        }
Example #2
0
        public void Test_TemperatureResponse_Creation()
        {
            var response = new TemperatureStatisticsResponse();

            Assert.True(response.ResultStatus == RequestErrorStatus.Unknown, "ResultStatus invalid after creation.");
            Assert.True(response.CellSize < Consts.TOLERANCE_DIMENSION, "CellSize invalid after creation.");
            Assert.True(response.SummaryCellsScanned == 0, "Invalid initial value for SummaryCellsScanned.");
            Assert.True(response.LastTempRangeMax == 0, "Invalid initial value for LastTempRangeMax.");
            Assert.True(response.LastTempRangeMin == 0, "Invalid initial value for LastTempRangeMin.");
            Assert.True(response.CellsScannedOverTarget == 0, "Invalid initial value for CellsScannedOverTarget.");
            Assert.True(response.CellsScannedAtTarget == 0, "Invalid initial value for CellsScannedAtTarget.");
            Assert.True(response.CellsScannedUnderTarget == 0, "Invalid initial value for CellsScannedUnderTarget.");
            Assert.True(response.IsTargetValueConstant, "Invalid initial value for IsTargetValueConstant.");
            Assert.True(!response.MissingTargetValue, "Invalid initial value for MissingTargetValue.");
        }
Example #3
0
        public void Test_TemperatureStatisticsResponse()
        {
            var response = new TemperatureStatisticsResponse()
            {
                ResultStatus            = RequestErrorStatus.OK,
                CellSize                = TestConsts.CELL_SIZE,
                CellsScannedOverTarget  = TestConsts.CELLS_OVER_TARGET,
                CellsScannedAtTarget    = TestConsts.CELLS_AT_TARGET,
                CellsScannedUnderTarget = TestConsts.CELLS_UNDER_TARGET,
                SummaryCellsScanned     = TestConsts.CELLS_OVER_TARGET + TestConsts.CELLS_AT_TARGET + TestConsts.CELLS_UNDER_TARGET,
                IsTargetValueConstant   = true,
                Counts             = TestConsts.CountsArray,
                MissingTargetValue = false,
                LastTempRangeMin   = 300,
                LastTempRangeMax   = 1500
            };

            SimpleBinarizableInstanceTester.TestClass(response, "Custom TemperatureStatisticsResponse not same after round trip serialisation");
        }
Example #4
0
        public void Test_TemperatureCoordinator_ReadOutResults_Successful()
        {
            var aggregator  = _getTemperatureAggregator();
            var coordinator = _getCoordinator();

            var response = new TemperatureStatisticsResponse();

            coordinator.ReadOutResults(aggregator, response);

            Assert.True(Math.Abs(response.CellSize - aggregator.CellSize) < Consts.TOLERANCE_DIMENSION, "CellSize invalid after result read-out.");
            Assert.True(response.SummaryCellsScanned == aggregator.SummaryCellsScanned, "Invalid read-out value for SummaryCellsScanned.");
            Assert.True(response.LastTempRangeMax == aggregator.LastTempRangeMax, "Invalid read-out value for LastTempRangeMax.");
            Assert.True(response.LastTempRangeMin == aggregator.LastTempRangeMin, "Invalid read-out value for LastTempRangeMin.");
            Assert.True(response.CellsScannedOverTarget == aggregator.CellsScannedOverTarget, "Invalid read-out value for CellsScannedOverTarget.");
            Assert.True(response.CellsScannedAtTarget == aggregator.CellsScannedAtTarget, "Invalid read-out value for CellsScannedAtTarget.");
            Assert.True(response.CellsScannedUnderTarget == aggregator.CellsScannedUnderTarget, "Invalid read-out value for CellsScannedUnderTarget.");
            Assert.True(response.IsTargetValueConstant == aggregator.IsTargetValueConstant, "Invalid read-out value for IsTargetValueConstant.");
            Assert.True(response.MissingTargetValue == aggregator.MissingTargetValue, "Invalid initial read-out for MissingTargetValue.");
        }