public void GetValuesOnTimeExtrapolator()
        {
            // create the component
            // connect query and output item
            // take care that component becomes valid and produces initial output for connected items
            ITimeSpaceComponent cf             = RainRrCfComponents.CreateChannelFlowInstance("CF-2");
            ITimeSpaceOutput    selectedOutput = RainRrCfCompositions.FindOutputItem(cf, "node-2.waterlevel");

            cf.Validate();

            ITimeSpaceAdaptedOutput timeExtrapolator =
                (ITimeSpaceAdaptedOutput)RainRrCfCompositions.ConnectItemsUsingAdaptedOutput(cf,
                                                                                             selectedOutput, _waterlevQueryItem,
                                                                                             RainRrCfCompositions.timeExtrapolatorId);

            // set query time for getting values
            _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 28, 12, 0, 0));
            ITimeSpaceValueSet values = timeExtrapolator.GetValues(_dischargeQueryItem);

            Assert.IsNotNull(values, "values != null");
            Assert.AreEqual(4001.5, (double)values.Values2D[0][0], "value[0] from GetValues 1");

            _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 29, 0, 0, 0));
            values = timeExtrapolator.GetValues(_dischargeQueryItem);
            Assert.IsNotNull(values, "values != null");
            Assert.AreEqual(4002.0, (double)values.Values2D[0][0], "value[0] from GetValues 1");

            _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 30, 0, 0, 0));
            timeExtrapolator.GetValues(_dischargeQueryItem);
            Assert.AreEqual(4002.0, (double)values.Values2D[0][0], "value[0] from GetValues 1");
        }
        private static IDictionary <string, ITimeSpaceComponent> CreateComponentInstances()
        {
            // create the involved components (rainfall measurements, rainfall runoff, 1D channel flow

            IDictionary <string, ITimeSpaceComponent> components = new Dictionary <string, ITimeSpaceComponent>();

            ITimeSpaceComponent rainfallMeasurementsInstance = RainRrCfComponents.CreateRainfallMeasurementsInstance(rainfallMeasurementsId);
            ITimeSpaceComponent rainfallRunoffInstance       = RainRrCfComponents.CreateRainfallRunoffInstance(rainfallRunoffId);
            ITimeSpaceComponent channelFlowLC = RainRrCfComponents.CreateChannelFlowInstance(channelFlowId);

            components.Add(rainfallMeasurementsId, rainfallMeasurementsInstance);
            components.Add(rainfallRunoffId, rainfallRunoffInstance);
            components.Add(channelFlowId, channelFlowLC);

            return(components);
        }
        public void GetValuesOnCfOutputItem()
        {
            // create the component
            // connect query and output item
            // take care that component becomes valid and produces initial output for connected items
            ITimeSpaceComponent cf             = RainRrCfComponents.CreateChannelFlowInstance("CF-2");
            ITimeSpaceOutput    selectedOutput = RainRrCfCompositions.FindOutputItem(cf, "node-4.discharge");

            selectedOutput.AddConsumer(_dischargeQueryItem);
            cf.Validate();

            // check initial values
            Assert.AreEqual(7000.0, (double)selectedOutput.Values.Values2D[0][0], "Value[0] as property");

            // set query time for getting values
            _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 28, 12, 0, 0));
            ITimeSpaceValueSet values = selectedOutput.GetValues(_dischargeQueryItem);

            Assert.IsNotNull(values, "values != null");
            Assert.AreEqual(7001.5, (double)values.Values2D[0][0], "value[0] from GetValues 1");

            _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 29, 0, 0, 0));
            values = selectedOutput.GetValues(_dischargeQueryItem);
            Assert.IsNotNull(values, "values != null");
            Assert.AreEqual(7002.0, (double)values.Values2D[0][0], "value[0] from GetValues 1");

            try
            {
                _dischargeQueryItem.TimeSet.SetSingleTimeStamp(new DateTime(2009, 3, 30, 0, 0, 0));
                selectedOutput.GetValues(_dischargeQueryItem);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e.Message.StartsWith("Could not update engine \""));
            }
        }