Example #1
0
        public void FlowDeviationSmokeTest()
        {
            var indicator = new FlowDeviationIndicator();

            foreach (var i in Enumerable.Range(0, 10))
            {
                var station = new Station {
                    Name = $"Station {i}"
                };

                for (var month = 0; month < 60; month++)
                {
                    station.Regulated.Add(new TimeseriesDatum
                    {
                        Time  = new DateTime(2018, 1, 1).AddMonths(month),
                        Value = 10
                    });
                    station.Unregulated.Add(new TimeseriesDatum
                    {
                        Time  = new DateTime(2018, 1, 1).AddMonths(month),
                        Value = 15
                    });
                }
                indicator.Stations.Add(station);
            }

            Assert.IsTrue(indicator.Value == 57);
        }
Example #2
0
        public void FlowDeviationCasesTest()
        {
            foreach (var fileSet in _testFiles)
            {
                var indicator = new FlowDeviationIndicator();
                foreach (var station in LoadStationsFromCsv(fileSet.Regulated, fileSet.Unregulated))
                {
                    indicator.Stations.Add(station);
                }

                Assert.IsTrue(indicator.Value == fileSet.FlowDeviation);
                foreach (var result in ReadAapfdCsv(fileSet.Aapfd))
                {
                    var station = indicator.Stations.First(x => x.Name == result.Name);
                    Assert.IsTrue(NearlyEqual(result.FlowDeviation, station.FlowDeviation));
                    Assert.IsTrue(NearlyEqual(result.NetAapfd, station.NetAapfd));
                }
            }
        }