Exemple #1
0
        public void testEventSetForWholeYears()
        {
            // Testing that catastrophe events are split correctly for periods of whole years

            EventSet      catRisk    = new EventSet(sampleEvents, eventsStart, eventsEnd);
            CatSimulation simulation = catRisk.newSimulation(new Date(1, Month.January, 2015), new Date(31, Month.December, 2015));

            QAssert.Require(simulation);

            List <KeyValuePair <Date, double> > path = new List <KeyValuePair <Date, double> >();

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(0, path.Count);

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(1, path.Count);
            QAssert.AreEqual(new Date(1, Month.February, 2015), path[0].Key);
            QAssert.AreEqual(100, path[0].Value);

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(1, path.Count);
            QAssert.AreEqual(new Date(1, Month.July, 2015), path[0].Key);
            QAssert.AreEqual(150, path[0].Value);

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(1, path.Count);
            QAssert.AreEqual(new Date(5, Month.January, 2015), path[0].Key);
            QAssert.AreEqual(50, path[0].Value);

            QAssert.Require(!simulation.nextPath(path));
        }
Exemple #2
0
        public void testEventSetForNoEvents()
        {
            // Testing that catastrophe events are split correctly when there are no simulated events

            List <KeyValuePair <Date, double> > emptyEvents = new List <KeyValuePair <Date, double> >();
            EventSet      catRisk    = new EventSet(emptyEvents, eventsStart, eventsEnd);
            CatSimulation simulation = catRisk.newSimulation(new Date(2, Month.January, 2015), new Date(5, Month.January, 2016));

            QAssert.Require(simulation);

            List <KeyValuePair <Date, double> > path = new List <KeyValuePair <Date, double> >();

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(0, path.Count);

            QAssert.Require(simulation.nextPath(path));
            QAssert.AreEqual(0, path.Count);

            QAssert.Require(!simulation.nextPath(path));
        }