public MeasurementObservationGroupFactory(ObservationPeriodInterval period)
        {
            switch (period)
            {
            case ObservationPeriodInterval.CorrelationId:
                _internalFactory = new CorrelationMeasurementObservationGroupFactory();
                break;

            case ObservationPeriodInterval.Single:
            case ObservationPeriodInterval.Hourly:
            case ObservationPeriodInterval.Daily:
                _internalFactory = new TimePeriodMeasurementObservationGroupFactory(period);
                break;

            default:
                throw new NotSupportedException($"ObservationPeriodInterval {period} is not supported.");
            }
        }
        public void GivenOtherPeriodInterval_WhenBuild_ThenTimePeriodMeasurementObservationGroupsReturned_Test(ObservationPeriodInterval periodInterval)
        {
            var factory = new MeasurementObservationGroupFactory(periodInterval);

            var seedDate = new DateTime(2019, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            var measurement = new IMeasurement[]
            {
                new Measurement
                {
                    OccurrenceTimeUtc = seedDate,
                    Properties        = new List <MeasurementProperty>
                    {
                        new MeasurementProperty {
                            Name = "a", Value = "1"
                        },
                    },
                },
            };

            var measureGroup = Substitute.For <IMeasurementGroup>()
                               .Mock(mg => mg.MeasureType.Returns("a"))
                               .Mock(mg => mg.Data.Returns(measurement));

            var observationGroup = factory.Build(measureGroup).First();

            Assert.IsType <TimePeriodMeasurementObservationGroup>(observationGroup);
        }