public void GetShiftReportDataWithMissingMachines(bool InitialState)
        {
            var TestDB = $"{nameof(DailyDepartmentTimePeriodReportTests)}.{nameof(GetReportData)}";

            var repo = new MachineRepository(databaseIP, "TestRunner", "1234", TimeSpan.FromMilliseconds(5000), databaseName: TestDB);

            if (repo.DoesDBExist(TestDB))
            {
                repo.DropDB(TestDB);
            }

            repo.CreateDB(TestDB);


            (int Hour, int Minute)ShiftStart = (07, 00);
            (int Hour, int Minute)ShiftEnd   = (15, 00);

            var testDepartment = "TestDepartment";

            (var ExpectedReportDataSorted, var ToWriteDataSorted) = ReportTestHelper.GenerateReportTestDataWithMissing(InitialState, testDepartment, ShiftStart, ShiftEnd);

            output.WriteLine($"Expected Data");
            foreach (var machine in ExpectedReportDataSorted)
            {
                output.WriteLine($"{machine.MachineInfo.Line}.{machine.MachineInfo.Name}");
                foreach (var state in machine.States)
                {
                    output.WriteLine($"\t{state}");
                }
            }

            output.WriteLine($"To Write Data");
            foreach (var machine in ToWriteDataSorted)
            {
                output.WriteLine($"{machine.MachineInfo.Line}.{machine.MachineInfo.Name}");
                foreach (var state in machine.States)
                {
                    output.WriteLine($"\t{state}");
                }
            }

            Assert.True(ExpectedReportDataSorted.Count() == ToWriteDataSorted.Count());

            for (int i = 0; i < ExpectedReportDataSorted.Count(); i++)
            {
                Assert.Equal(ExpectedReportDataSorted[i].States.Count, ToWriteDataSorted[i].States.Count);

                for (int a = 0; a < ExpectedReportDataSorted[i].States.Count; a++)
                {
                    Assert.Equal(ExpectedReportDataSorted[i].States[a].State, ToWriteDataSorted[i].States[a].State);
                    Assert.Equal(ExpectedReportDataSorted[i].States[a].TimeSpan.Milliseconds, ToWriteDataSorted[i].States[a].TimeSpan.Milliseconds);
                }
            }

            var toSendData = ReportTestHelper.ConvertExpectedToTestInputDataMulti(testDepartment, ToWriteDataSorted.ToArray(), null);

            repo.MachineIsRunningRepo.WriteAsync(toSendData).Wait();

            try
            {
                var ShiftReport = new DepartmentTimePeriodReportForCurrentDay("*****@*****.**", new[] { "*****@*****.**" },
                                                                              testDepartment, "localhost", 2500, null, $"ReportTemplates{Path.DirectorySeparatorChar}DepartmentReportView.cshtml", repo)
                {
                    StartTime = ShiftStart,
                    EndTime   = ShiftEnd,
                    Name      = "1st Shift Report (Test)"
                };

                var returnedResults = ShiftReport.GetReportData().Result;

                var ReturnedResultSorted = returnedResults.OrderBy(x => x.MachineInfo.Line).ThenBy(x => x.MachineInfo.Name);

                foreach (var machine in ReturnedResultSorted)
                {
                    machine.States = machine.States.OrderBy(x => x.Start).ThenBy(x => x.End).ThenBy(x => x.State).ToList();
                }

                output.WriteLine($"Date has been returned and sorted");

                //** Output data to "Console"
                foreach (var machine in ReturnedResultSorted)
                {
                    output.WriteLine($"{machine.MachineInfo.Line}.{machine.MachineInfo.Name}");
                    foreach (var state in machine.States)
                    {
                        output.WriteLine($"\t{state}");
                    }
                }

                ReturnedResultSorted.ShouldDeepEqual(ExpectedReportDataSorted);
            }
            finally
            {
                repo.DropDB(TestDB);
            }
        }
        //** TODO This Test need cleaned up immensely

        public void GetTimePeriodReportDataWithMissingMachines(bool InitialState, int[] ReportTimePeriodStartAsArray, int [] ReportTimePeriodEndAsArray, int[] marginAsArray)
        {
            TimeSpan margin = TimeSpan.FromHours(marginAsArray[0]) + TimeSpan.FromMinutes(marginAsArray[1]) + TimeSpan.FromSeconds(marginAsArray[2]) + TimeSpan.FromMilliseconds(marginAsArray[3]);

            (int Hour, int Minute)ReportTimePeriodStart = (ReportTimePeriodStartAsArray[0], ReportTimePeriodStartAsArray[1]);
            (int Hour, int Minute)ReportTimePeriodEnd   = (ReportTimePeriodEndAsArray[0], ReportTimePeriodEndAsArray[1]);

            var TestDB = $"{nameof(DailyDepartmentTimePeriodReportTests)}.{nameof(GetReportData)}";

            var repo = new MachineRepository(databaseIP, "TestRunner", "1234", TimeSpan.FromMilliseconds(5000), databaseName: TestDB);

            if (repo.DoesDBExist(TestDB))
            {
                repo.DropDB(TestDB);
            }

            repo.CreateDB(TestDB);

            var testDepartment = "TestDepartment";

            (var ExpectedReportDataSorted, var ToWriteDataSorted) = ReportTestHelper.GenerateReportTestDataWithMissing(InitialState, testDepartment, ReportTimePeriodStart, ReportTimePeriodEnd, margin);

            //** Validate generated Data, yes, I am testing part of my test, this is smelly and need to be fixed.
            Assert.True(ExpectedReportDataSorted.Count() == ToWriteDataSorted.Count());

            for (int i = 0; i < ExpectedReportDataSorted.Count(); i++)
            {
                Assert.Equal(ExpectedReportDataSorted[i].States.Count, ToWriteDataSorted[i].States.Count);

                for (int a = 0; a < ExpectedReportDataSorted[i].States.Count; a++)
                {
                    Assert.Equal(ExpectedReportDataSorted[i].States[a].State, ToWriteDataSorted[i].States[a].State);
                }
            }

            var toSendData = ReportTestHelper.ConvertExpectedToTestInputDataMulti(testDepartment, ToWriteDataSorted.ToArray(), null);

            repo.MachineIsRunningRepo.WriteAsync(toSendData).Wait();

            try
            {
                var ShiftReport = new DepartmentTimePeriodReportForCurrentDay("*****@*****.**", new[] { "*****@*****.**" },
                                                                              testDepartment, "localhost", 2500, null, $"ReportTemplates{Path.DirectorySeparatorChar}DepartmentReportView.cshtml", repo)
                {
                    StartTime = ReportTimePeriodStart,
                    EndTime   = ReportTimePeriodEnd,
                    Name      = "1st Shift Report (Test)"
                };

                var returnedResults = ShiftReport.GetReportData().Result;

                var ReturnedResultSorted = returnedResults.OrderBy(x => x.MachineInfo.Line).ThenBy(x => x.MachineInfo.Name);

                foreach (var machine in ReturnedResultSorted)
                {
                    machine.States = machine.States.OrderBy(x => x.Start).ThenBy(x => x.End).ThenBy(x => x.State).ToList();
                }

                output.WriteLine($"Date has been returned and sorted");

                //** Output data to "Console"
                foreach (var machine in ReturnedResultSorted)
                {
                    output.WriteLine($"{machine.MachineInfo.Line}.{machine.MachineInfo.Name}");
                    foreach (var state in machine.States)
                    {
                        output.WriteLine($"\t{state}");
                    }
                }
                try
                {
                    ReturnedResultSorted.ShouldDeepEqual(ExpectedReportDataSorted);
                }
                catch (Exception ex)
                {
                    string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    string FilePath    = $"{desktopPath}{Path.DirectorySeparatorChar}{nameof(GetTimePeriodReportDataWithMissingMachines)}Failure{DateTime.Now.Ticks}";
                    ObjectDifferenceWriter.DumpToFile(
                        ReturnedResultSorted.WithDeepEqual(ExpectedReportDataSorted).Expected,
                        ReturnedResultSorted.WithDeepEqual(ExpectedReportDataSorted).Actual,
                        FilePath
                        );
                    throw;
                }
            }
            finally
            {
                repo.DropDB(TestDB);
            }
        }