public MetricsTestData(MonitorQueryTestEnvironment environment, DateTimeOffset dateTimeOffset)
        {
            _testEnvironment = environment;

            var recordingUtcNow = dateTimeOffset;

            // Snap to 15 minute intervals
            StartTime = recordingUtcNow.AddTicks(-(Duration.Ticks + recordingUtcNow.Ticks % Duration.Ticks));

            MetricName      = "CowsHappiness";
            MetricNamespace = "Cows";
        }
        public LogsTestData(RecordedTestBase <MonitorQueryTestEnvironment> test)
        {
            _testEnvironment = test.TestEnvironment;

            var recordingUtcNow = DateTime.SpecifyKind(test.Recording.UtcNow.Date, DateTimeKind.Utc);

            RetentionWindowStart = recordingUtcNow.AddDays(DayOfWeek.Monday - recordingUtcNow.DayOfWeek - 7);

            TableA = new()
            {
                new()
                {
                    { IntColumnNameSent, 1 },
                    { StringColumnNameSent, "a" },
                    { BoolColumnNameSent, false },
        public MetricsTestData(MonitorQueryTestEnvironment environment, DateTimeOffset dateTimeOffset)
        {
            _testEnvironment = environment;

            // The service allows metrics sent maximum 4 minutes into the future
            var maxTimeInTheFuture = dateTimeOffset.AddMinutes(4);

            // Snap to 15 minute intervals
            StartTime = dateTimeOffset.AddTicks(-(dateTimeOffset.Ticks % Duration.Ticks));
            // Back off until we are in the allowed range
            while (StartTime + Duration > maxTimeInTheFuture)
            {
                StartTime -= Duration;
            }

            MetricName      = "CowsHappiness";
            MetricNamespace = "Cows";
        }