public void TestMethodSampledMeasurementList()
        {
            Measurement[] expectedMeasurement   = new Measurement[7];
            Sampling      actualSampling        = new Sampling();
            Instant       actualStartOfSampling = new Instant()
            {
                Time = DateTime.Parse("2017-01-03T10:00:00"),
            };
            List <Measurement> actualUnsampledList =
                actualSampling.CreateSamples();

            List <Measurement>[] actualListsArray =
                actualSampling.CreateLists(actualUnsampledList);
            List <Measurement> actualTemperatureSampledList =
                actualSampling.SampledMeasurementList(actualStartOfSampling, actualListsArray[0]);
            List <Measurement> actualSPO2SampledList =
                actualSampling.SampledMeasurementList(actualStartOfSampling, actualListsArray[1]);

            // Creates measurementsArray and fills values.
            expectedMeasurement[0] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:05:00")
                },
                MeasurementValue = 35.79,
                Type             = MeasurementType.TEMP
            };
            expectedMeasurement[1] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:10:00")
                },
                MeasurementValue = 35.01,
                Type             = MeasurementType.TEMP
            };
            expectedMeasurement[2] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:05:00")
                },
                MeasurementValue = 97.17,
                Type             = MeasurementType.SPO2
            };
            expectedMeasurement[3] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:10:00")
                },
                MeasurementValue = 95.08,
                Type             = MeasurementType.SPO2
            };

            // Checks for right lengths. Shall be 2.
            Assert.AreEqual(2, actualTemperatureSampledList.Count);
            Assert.AreEqual(2, actualTemperatureSampledList.Count);

            // Checks actualTemperatureSampledList is sorted and is equal.
            Assert.AreEqual(expectedMeasurement[0].MeasurementTime.Time,
                            actualTemperatureSampledList.ToArray()[0].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[0].MeasurementValue,
                            actualTemperatureSampledList.ToArray()[0].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[0].Type,
                            actualTemperatureSampledList.ToArray()[0].Type);
            Assert.AreEqual(expectedMeasurement[1].MeasurementTime.Time,
                            actualTemperatureSampledList.ToArray()[1].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[1].MeasurementValue,
                            actualTemperatureSampledList.ToArray()[1].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[1].Type,
                            actualTemperatureSampledList.ToArray()[1].Type);

            // Checks actualSpo2SampledList is sorted and is equal.
            Assert.AreEqual(expectedMeasurement[2].MeasurementTime.Time,
                            actualSPO2SampledList.ToArray()[0].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[2].MeasurementValue,
                            actualSPO2SampledList.ToArray()[0].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[2].Type,
                            actualSPO2SampledList.ToArray()[0].Type);
            Assert.AreEqual(expectedMeasurement[3].MeasurementTime.Time,
                            actualSPO2SampledList.ToArray()[1].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[3].MeasurementValue,
                            actualSPO2SampledList.ToArray()[1].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[3].Type,
                            actualSPO2SampledList.ToArray()[1].Type);
        }
        public void TestMethodCreatesLists()
        {
            Measurement[]      expectedMeasurement = new Measurement[7];
            Sampling           actualSampling      = new Sampling();
            List <Measurement> actualUnsampledList = actualSampling.CreateSamples();

            List <Measurement>[] actualListsArray = actualSampling.CreateLists(actualUnsampledList);

            // Creates measurementsArray and fills values.
            expectedMeasurement[0] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:04:45")
                },
                MeasurementValue = 35.79,
                Type             = MeasurementType.TEMP
            };
            expectedMeasurement[1] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:01:18")
                },
                MeasurementValue = 98.78,
                Type             = MeasurementType.SPO2
            };
            expectedMeasurement[2] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:09:07")
                },
                MeasurementValue = 35.01,
                Type             = MeasurementType.TEMP
            };
            expectedMeasurement[3] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:03:34")
                },
                MeasurementValue = 96.49,
                Type             = MeasurementType.SPO2
            };
            expectedMeasurement[4] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:02:01")
                },
                MeasurementValue = 35.82,
                Type             = MeasurementType.TEMP
            };
            expectedMeasurement[5] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:05:00")
                },
                MeasurementValue = 97.17,
                Type             = MeasurementType.SPO2
            };
            expectedMeasurement[6] = new Measurement
            {
                MeasurementTime = new Instant()
                {
                    Time = DateTime.Parse("2017-01-03T10:05:01")
                },
                MeasurementValue = 95.08,
                Type             = MeasurementType.SPO2
            };

            // Checks for content is 3 and list of spo2 has 4 centries.
            Assert.AreEqual(3, actualListsArray[0].Count);
            Assert.AreEqual(4, actualListsArray[1].Count);

            // Checks list of temperatures for 3 right entries.
            Assert.AreEqual(expectedMeasurement[0].MeasurementTime.Time, actualListsArray[0].ToArray()[0].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[0].MeasurementValue, actualListsArray[0].ToArray()[0].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[0].Type, actualListsArray[0].ToArray()[0].Type);
            Assert.AreEqual(expectedMeasurement[2].MeasurementTime.Time, actualListsArray[0].ToArray()[1].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[2].MeasurementValue, actualListsArray[0].ToArray()[1].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[2].Type, actualListsArray[0].ToArray()[1].Type);
            Assert.AreEqual(expectedMeasurement[4].MeasurementTime.Time, actualListsArray[0].ToArray()[2].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[4].MeasurementValue, actualListsArray[0].ToArray()[2].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[4].Type, actualListsArray[0].ToArray()[2].Type);

            // Checks list of spo2 for 4 right entries.
            Assert.AreEqual(expectedMeasurement[1].MeasurementTime.Time, actualListsArray[1].ToArray()[0].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[1].MeasurementValue, actualListsArray[1].ToArray()[0].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[1].Type, actualListsArray[1].ToArray()[0].Type);
            Assert.AreEqual(expectedMeasurement[3].MeasurementTime.Time, actualListsArray[1].ToArray()[1].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[3].MeasurementValue, actualListsArray[1].ToArray()[1].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[3].Type, actualListsArray[1].ToArray()[1].Type);
            Assert.AreEqual(expectedMeasurement[5].MeasurementTime.Time, actualListsArray[1].ToArray()[2].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[5].MeasurementValue, actualListsArray[1].ToArray()[2].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[5].Type, actualListsArray[1].ToArray()[2].Type);
            Assert.AreEqual(expectedMeasurement[6].MeasurementTime.Time, actualListsArray[1].ToArray()[3].MeasurementTime.Time);
            Assert.AreEqual(expectedMeasurement[6].MeasurementValue, actualListsArray[1].ToArray()[3].MeasurementValue);
            Assert.AreEqual(expectedMeasurement[6].Type, actualListsArray[1].ToArray()[3].Type);
        }